comparison pytouhou/game/text.py @ 347:b150ed7188a2

Show the size of the spellcard life.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 05 Jul 2012 00:53:16 +0200
parents 862011266f2c
children f1649d6c6397
comparison
equal deleted inserted replaced
346:862011266f2c 347:b150ed7188a2
149 self.changed = True 149 self.changed = True
150 150
151 151
152 152
153 class Gauge(object): 153 class Gauge(object):
154 def __init__(self, pos, anm_wrapper, max_length=280, maximum=1, value=0.): 154 def __init__(self, pos, anm_wrapper, max_length=280, maximum=1, value=0):
155 self.sprite = Sprite() 155 self.sprite = Sprite()
156 self.anmrunner = ANMRunner(anm_wrapper, 21, self.sprite) 156 self.anmrunner = ANMRunner(anm_wrapper, 21, self.sprite)
157 self.anmrunner.run_frame() 157 self.anmrunner.run_frame()
158 self.removed = False 158 self.removed = False
159 self.sprite.corner_relative_placement = True #TODO: perhaps not right 159 self.sprite.corner_relative_placement = True #TODO: perhaps not right
170 self.sprite.width_override = self.max_length * value / self.maximum 170 self.sprite.width_override = self.max_length * value / self.maximum
171 self.sprite.changed = True #TODO 171 self.sprite.changed = True #TODO
172 172
173 173
174 def update(self): 174 def update(self):
175 #XXX
176 if self.value == 0:
177 self.sprite.visible = False
178 else:
179 self.sprite.visible = True
175 if self.anmrunner and not self.anmrunner.run_frame(): 180 if self.anmrunner and not self.anmrunner.run_frame():
176 self.anmrunner = None 181 self.anmrunner = None
177 182
178 183