comparison pytouhou/game/enemy.py @ 316:f0be7ea62330

Fix a bug with ECL instruction 96, and fix overall ECL handling. The issue with instruction 96 was about death callbacks, being executed on the caller of instruction 96 instead of the dying enemies. This was introduced by changeset 5930b33a0370. Additionnaly, ECL processes are now an attribute of the Enemy, and death/timeout conditions are checked right after the ECL frame, even if the ECL script has already ended, just like in the original game.
author Thibaut Girka <thib@sitedethib.com>
date Thu, 29 Mar 2012 21:18:35 +0200
parents 550ec10cccbc
children 1366cefd0334
comparison
equal deleted inserted replaced
315:e935ed8dc5e6 316:f0be7ea62330
26 def __init__(self, pos, life, _type, bonus_dropped, die_score, anm_wrapper, game): 26 def __init__(self, pos, life, _type, bonus_dropped, die_score, anm_wrapper, game):
27 self._game = game 27 self._game = game
28 self._anm_wrapper = anm_wrapper 28 self._anm_wrapper = anm_wrapper
29 self._type = _type 29 self._type = _type
30 30
31 self.process = None
31 self.sprite = None 32 self.sprite = None
32 self.anmrunner = None 33 self.anmrunner = None
33 self.removed = False 34 self.removed = False
34 self.visible = True 35 self.visible = True
35 self.was_visible = False 36 self.was_visible = False
338 # Apply damages 339 # Apply damages
339 self.life -= damages 340 self.life -= damages
340 341
341 342
342 def update(self): 343 def update(self):
344 if self.process:
345 self.process.run_iteration()
346
343 x, y = self.x, self.y 347 x, y = self.x, self.y
344 348
345 if self.update_mode == 1: 349 if self.update_mode == 1:
346 speed = 0.0 350 speed = 0.0
347 if self.interpolator: 351 if self.interpolator: