comparison nagslang/screens/area.py @ 385:51deb78cae52

Use a result object to get new drawables back to the area
author Stefano Rivera <stefano@rivera.za.net>
date Fri, 06 Sep 2013 23:58:15 +0200
parents 21c1c329f8e3
children 866cdc74b26a
comparison
equal deleted inserted replaced
384:9efc1ab833c8 385:51deb78cae52
241 241
242 def tick(self, seconds): 242 def tick(self, seconds):
243 super(AreaScreen, self).tick(seconds) 243 super(AreaScreen, self).tick(seconds)
244 self.tick_protagonist() 244 self.tick_protagonist()
245 for drawable in self._drawables: 245 for drawable in self._drawables:
246 drawable.update(seconds) 246 result = drawable.update(seconds)
247 if drawable.remove: 247 if result is not None:
248 self._drawables.remove(drawable) 248 for new_drawable in result.add:
249 self._drawables.add(new_drawable)
250 for old_drawable in result.remove:
251 self._drawables.remove(old_drawable)
249 252
250 def render_health_bar(self, surface, damage_experienced=None): 253 def render_health_bar(self, surface, damage_experienced=None):
251 bar_surface = pygame.Surface((110, 50)).convert(surface) 254 bar_surface = pygame.Surface((110, 50)).convert(surface)
252 if damage_experienced: 255 if damage_experienced:
253 health_box_colour = pygame.color.THECOLORS['red'] 256 health_box_colour = pygame.color.THECOLORS['red']