Mercurial > touhou
diff pytouhou/game/sprite.py @ 17:d940d004b840
Make game.sprite.Sprite use its own frame counter.
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Tue, 09 Aug 2011 11:40:13 +0200 |
parents | 07fba4e1da65 |
children | bf225780973f |
line wrap: on
line diff
--- a/pytouhou/game/sprite.py +++ b/pytouhou/game/sprite.py @@ -11,6 +11,7 @@ class Sprite(object): self.rescale = (1., 1.) self.rotations_3d = (0., 0., 0.) self.corner_relative_placement = False + self.frame = 0 self._uvs = [] self._vertices = [] @@ -66,14 +67,16 @@ class Sprite(object): - def update(self, frame, override_width=0, override_height=0): + def update(self, override_width=0, override_height=0): properties = {} for time, instr_type, data in self.anm.scripts[self.script_index]: - if time == frame: + if time == self.frame: if instr_type == 15: #Return break else: properties[instr_type] = data + self.frame += 1 + if properties: if 1 in properties: self.texcoords = self.anm.sprites[unpack('<I', properties[1])[0]]