Mercurial > touhou
comparison pytouhou/game/face.py @ 304:f3099ebf4f61
Update attribute names to reflect the actual interface.
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Tue, 13 Mar 2012 18:38:14 +0100 |
parents | 4838e9bab0f9 |
children | 690b5faaa0e6 |
comparison
equal
deleted
inserted
replaced
303:647bde10353d | 304:f3099ebf4f61 |
---|---|
16 from pytouhou.game.sprite import Sprite | 16 from pytouhou.game.sprite import Sprite |
17 from pytouhou.vm.anmrunner import ANMRunner | 17 from pytouhou.vm.anmrunner import ANMRunner |
18 | 18 |
19 | 19 |
20 class Face(object): | 20 class Face(object): |
21 __slots__ = ('_anm_wrapper', '_sprite', '_anmrunner', 'side', 'x', 'y') | 21 __slots__ = ('_anm_wrapper', 'sprite', 'anmrunner', 'side', 'x', 'y') |
22 | 22 |
23 def __init__(self, anm_wrapper, effect, side): | 23 def __init__(self, anm_wrapper, effect, side): |
24 self._anm_wrapper = anm_wrapper | 24 self._anm_wrapper = anm_wrapper |
25 self._sprite = Sprite() | 25 self.sprite = Sprite() |
26 self._anmrunner = ANMRunner(anm_wrapper, side * 2, self._sprite) | 26 self.anmrunner = ANMRunner(anm_wrapper, side * 2, self.sprite) |
27 self.side = side | 27 self.side = side |
28 self.load(0) | 28 self.load(0) |
29 self.animate(effect) | 29 self.animate(effect) |
30 | 30 |
31 #FIXME: the same as game.effect. | 31 #FIXME: the same as game.effect. |
32 self.x = -32 | 32 self.x = -32 |
33 self.y = -16 | 33 self.y = -16 |
34 self._sprite.allow_dest_offset = True | 34 self.sprite.allow_dest_offset = True |
35 | 35 |
36 | 36 |
37 def animate(self, effect): | 37 def animate(self, effect): |
38 self._anmrunner.interrupt(effect) | 38 self.anmrunner.interrupt(effect) |
39 | 39 |
40 | 40 |
41 def load(self, index): | 41 def load(self, index): |
42 self._sprite.anm, self._sprite.texcoords = self._anm_wrapper.get_sprite(self.side * 8 + index) | 42 self.sprite.anm, self.sprite.texcoords = self._anm_wrapper.get_sprite(self.side * 8 + index) |
43 self._anmrunner.run_frame() | 43 self.anmrunner.run_frame() |
44 | 44 |
45 | 45 |
46 def update(self): | 46 def update(self): |
47 self._anmrunner.run_frame() | 47 self.anmrunner.run_frame() |
48 |