comparison pytouhou/games/eosd.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 685b782a4da4
comparison
equal deleted inserted replaced
346:862011266f2c 347:b150ed7188a2
137 self.labels['boss_lives'].set_color('yellow') 137 self.labels['boss_lives'].set_color('yellow')
138 138
139 self.boss_items = [ 139 self.boss_items = [
140 Effect((0, 0), 19, front), # Enemy 140 Effect((0, 0), 19, front), # Enemy
141 Gauge((100, 24), front), # Gauge 141 Gauge((100, 24), front), # Gauge
142 Gauge((100, 24), front), # Spellcard gauge
142 ] 143 ]
143 for item in self.boss_items: 144 for item in self.boss_items:
144 item.sprite.allow_dest_offset = True #XXX 145 item.sprite.allow_dest_offset = True #XXX
145 146
146 147
147 def set_boss_life(self): 148 def set_boss_life(self):
148 self.boss_items[1].maximum = self.game.boss._enemy.life 149 self.boss_items[1].maximum = self.game.boss._enemy.life
150 self.boss_items[2].maximum = self.game.boss._enemy.life
151
152
153 def set_spell_life(self):
154 self.boss_items[2].set_value(self.game.boss._enemy.low_life_trigger)
149 155
150 156
151 def update(self): 157 def update(self):
152 for elem in self.items: 158 for elem in self.items:
153 elem.update() 159 elem.update()
166 if self.game.boss: 172 if self.game.boss:
167 boss = self.game.boss._enemy 173 boss = self.game.boss._enemy
168 174
169 life_gauge = self.boss_items[1] 175 life_gauge = self.boss_items[1]
170 life_gauge.set_value(boss.life) 176 life_gauge.set_value(boss.life)
177
178 spell_gauge = self.boss_items[2]
179 spell_gauge.sprite.color = (255, 192, 192)
180 if boss.life < spell_gauge.value:
181 spell_gauge.set_value(boss.life)
171 182
172 for item in self.boss_items: 183 for item in self.boss_items:
173 item.update() 184 item.update()
174 185
175 self.labels['boss_lives'].set_text('%d' % boss.remaining_lives) 186 self.labels['boss_lives'].set_text('%d' % boss.remaining_lives)