comparison pytouhou/game/effect.py @ 173:35d850502d1f

Move effects where they should be.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 21 Oct 2011 09:37:23 -0700
parents
children 184196480f59
comparison
equal deleted inserted replaced
172:ea2ad94c33a0 173:35d850502d1f
1 # -*- encoding: utf-8 -*-
2 ##
3 ## Copyright (C) 2011 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
4 ##
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published
7 ## by the Free Software Foundation; version 3 only.
8 ##
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ## GNU General Public License for more details.
13 ##
14
15
16 from pytouhou.game.sprite import Sprite
17 from pytouhou.vm.anmrunner import ANMRunner
18
19
20
21 class Effect(object):
22 def __init__(self, pos, index, anm_wrapper):
23 self._sprite = Sprite()
24 self._anmrunner = ANMRunner(anm_wrapper, index, self._sprite)
25 self._anmrunner.run_frame()
26 self._removed = False
27
28 self.x, self.y = pos
29
30 def update(self):
31 if self._anmrunner and not self._anmrunner.run_frame():
32 self._anmrunner = None
33
34 if self._sprite:
35 if self._sprite._removed:
36 self._sprite = None