comparison pytouhou/game/effect.py @ 440:b9d2db93972f

Add a base Element class for every object in pytouhou.game.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 30 Aug 2013 14:16:08 +0200
parents 1222341ea22c
children
comparison
equal deleted inserted replaced
439:723a3e67a223 440:b9d2db93972f
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ## GNU General Public License for more details. 12 ## GNU General Public License for more details.
13 ## 13 ##
14 14
15 15
16 from pytouhou.game.element import Element
16 from pytouhou.game.sprite import Sprite 17 from pytouhou.game.sprite import Sprite
17 from pytouhou.vm.anmrunner import ANMRunner 18 from pytouhou.vm.anmrunner import ANMRunner
18 from pytouhou.utils.interpolator import Interpolator 19 from pytouhou.utils.interpolator import Interpolator
19 20
20 21
21 22
22 class Effect(object): 23 class Effect(Element):
23 def __init__(self, pos, index, anm): 24 def __init__(self, pos, index, anm):
25 Element.__init__(self, pos)
24 self.sprite = Sprite() 26 self.sprite = Sprite()
25 self.anmrunner = ANMRunner(anm, index, self.sprite) 27 self.anmrunner = ANMRunner(anm, index, self.sprite)
26 self.removed = False
27 self.objects = [self]
28
29 self.x, self.y = pos
30 28
31 29
32 def update(self): 30 def update(self):
33 if self.anmrunner and not self.anmrunner.run_frame(): 31 if self.anmrunner and not self.anmrunner.run_frame():
34 self.anmrunner = None 32 self.anmrunner = None