# HG changeset patch # User Thibaut Girka # Date 1313321698 -7200 # Node ID 4d93d45ecb62776d9043dc95d0bdd804b2f687c1 # Parent 1f21bcc0845baf94ed7fd2bc41c393169c9c1244 Fix animation script flow handling diff --git a/pytouhou/game/enemymanager.py b/pytouhou/game/enemymanager.py --- a/pytouhou/game/enemymanager.py +++ b/pytouhou/game/enemymanager.py @@ -150,6 +150,9 @@ class Enemy(object): visible = self.is_visible(384, 448) if changed and visible: self.sprite.update_uvs_vertices() + elif not self.sprite.playing: + visible = False + self.sprite = None else: visible = False diff --git a/pytouhou/game/sprite.py b/pytouhou/game/sprite.py --- a/pytouhou/game/sprite.py +++ b/pytouhou/game/sprite.py @@ -25,6 +25,8 @@ class Sprite(object): self.rotations_speed_3d = (0., 0., 0.) self.corner_relative_placement = False self.instruction_pointer = 0 + self.keep_still = False + self.playing = True self.frame = 0 self._uvs = [] self._vertices = [] @@ -69,38 +71,43 @@ class Sprite(object): def update(self): + if not self.playing: + return False + changed = False frame = self.frame - script = self.anm.scripts[self.script_index] - try: - while frame <= self.frame: - frame, instr_type, data = script[self.instruction_pointer] - if frame == self.frame: - changed = True - if instr_type == 1: - self.texcoords = self.anm.sprites[unpack('