diff 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
line wrap: on
line diff
--- a/pytouhou/game/enemy.py
+++ b/pytouhou/game/enemy.py
@@ -28,6 +28,7 @@ class Enemy(object):
         self._anm_wrapper = anm_wrapper
         self._type = _type
 
+        self.process = None
         self.sprite = None
         self.anmrunner = None
         self.removed = False
@@ -340,6 +341,9 @@ class Enemy(object):
 
 
     def update(self):
+        if self.process:
+            self.process.run_iteration()
+
         x, y = self.x, self.y
 
         if self.update_mode == 1: