changeset 248:77b83064b57e

Use the correct animation for player death.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 21 Jan 2012 21:03:53 +0100
parents fb3a263213d1
children 2ef8f4e181e3
files pytouhou/game/enemy.py pytouhou/game/game.py pytouhou/game/player.py
diffstat 3 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/enemy.py
+++ b/pytouhou/game/enemy.py
@@ -175,7 +175,8 @@ class Enemy(object):
 
 
     def die_anim(self):
-        self._game.new_death((self.x, self.y), self.death_anim)
+        anim = {0: 3, 1: 4, 2: 5}[self.death_anim % 256] # The TB is wanted, if index isn’t in these values the original game crashs.
+        self._game.new_effect((self.x, self.y), anim)
 
 
     def drop_particles(self, number, color):
--- a/pytouhou/game/game.py
+++ b/pytouhou/game/game.py
@@ -116,9 +116,8 @@ class Game(object):
         self.bullets = []
 
 
-    def new_death(self, pos, index):
-        anim = {0: 3, 1: 4, 2: 5}[index % 256] # The TB is wanted, if index isn’t in these values the original game crashs.
-        self.effects.append(Effect(pos, anim, self.etama4))
+    def new_effect(self, pos, anim, anm_wrapper=None):
+        self.effects.append(Effect(pos, anim, anm_wrapper or self.etama4))
 
 
     def new_particle(self, pos, color, size, amp):
--- a/pytouhou/game/player.py
+++ b/pytouhou/game/player.py
@@ -91,7 +91,7 @@ class Player(object):
     def collide(self):
         if not self.state.invulnerable_time and not self.death_time and self.state.touchable: # Border Between Life and Death
             self.death_time = self._game.frame
-            self._game.new_death((self.state.x, self.state.y), 2)
+            self._game.new_effect((self.state.x, self.state.y), 17)
             self._game.modify_difficulty(-1600)
             for i in range(16):
                 self._game.new_particle((self.state.x, self.state.y), 2, 4., 256) #TODO: find the real size and range.