comparison pytouhou/game/face.py @ 430:c9433188ffdb

Remove AnmWrapper, since ANMs are lists of entries now.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 03 Aug 2013 15:49:04 +0200
parents 690b5faaa0e6
children 1222341ea22c
comparison
equal deleted inserted replaced
429:40d5f3083ebc 430:c9433188ffdb
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', 'objects') 21 __slots__ = ('_anms', 'sprite', 'anmrunner', 'side', 'x', 'y', 'objects')
22 22
23 def __init__(self, anm_wrapper, effect, side): 23 def __init__(self, anms, effect, side):
24 self._anm_wrapper = anm_wrapper 24 self._anms = anms
25 self.sprite = Sprite() 25 self.sprite = Sprite()
26 self.anmrunner = ANMRunner(anm_wrapper, side * 2, self.sprite) 26 self.anmrunner = ANMRunner(self._anms[0][0][0], 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 self.objects = [self] 30 self.objects = [self]
31 31
38 def animate(self, effect): 38 def animate(self, effect):
39 self.anmrunner.interrupt(effect) 39 self.anmrunner.interrupt(effect)
40 40
41 41
42 def load(self, index): 42 def load(self, index):
43 self.sprite.anm, self.sprite.texcoords = self._anm_wrapper.get_sprite(self.side * 8 + index) 43 self.sprite.anm, self.sprite.texcoords = self._anms[self.side][index]
44 self.anmrunner.run_frame() 44 self.anmrunner.run_frame()
45 45
46 46
47 def update(self): 47 def update(self):
48 self.anmrunner.run_frame() 48 self.anmrunner.run_frame()
49