# HG changeset patch # User Emmanuel Gil Peyrot # Date 1319621930 25200 # Node ID 54eb6b254b7b6f88ed95acfe1a7d5f920b841648 # Parent b6d7ce644f342fc6e2aa5da30e19c74fb462699c When touched, drop the items at the right place, and add precisions about particles. diff --git a/pytouhou/game/enemy.py b/pytouhou/game/enemy.py --- a/pytouhou/game/enemy.py +++ b/pytouhou/game/enemy.py @@ -169,6 +169,7 @@ class Enemy(object): def on_attack(self, bullet): if self.damageable: self.life -= bullet._bullet_type.damage + self._game.new_particle((self.x, self.y), 1, 3., 192) #TODO: find the real size and range. def on_collide(self): @@ -180,7 +181,7 @@ class Enemy(object): #TODO: 8 white particles are used only in stage 3 to 6, # in other stages they are 2 red and 6 blue. for i in range(8): - self._game.new_particle((self.x, self.y), 0, 3., 192) + self._game.new_particle((self.x, self.y), 0, 3., 192) #TODO: find the real size and range. def set_pos(self, x, y, z): diff --git a/pytouhou/game/game.py b/pytouhou/game/game.py --- a/pytouhou/game/game.py +++ b/pytouhou/game/game.py @@ -163,8 +163,9 @@ class Game(object): elif not bullet.grazed and not (bx2 < gx1 or bx1 > gx2 or by2 < gy1 or by1 > gy2): bullet.grazed = True + player.state.graze += 1 player.state.score += 500 # found experimentally - self.new_particle((px, py), 0, .8, 192) + self.new_particle((px, py), 0, .8, 192) #TODO: find the real size and range. #TODO: display a static particle during one frame at # 12 pixels of the player, in the axis of the “collision”. diff --git a/pytouhou/game/player.py b/pytouhou/game/player.py --- a/pytouhou/game/player.py +++ b/pytouhou/game/player.py @@ -127,12 +127,22 @@ class Player(object): time = self._game.frame - self.death_time if time == 6: # too late, you are dead :( self.state.touchable = False - self._game.drop_bonus(self.state.x, self.state.y, 2, end_pos=None) #TODO: find the formula + self.state.lives -= 1 + if self.state.power > 16: + self.state.power -= 16 + else: + self.state.power = 0 + + self._game.drop_bonus(self.state.x, self.state.y, 2, + end_pos=(self._game.prng.rand_double() * 288 + 48, # 102h.exe@0x41f3dc + self._game.prng.rand_double() * 192 - 64)) # @0x41f3 for i in range(5): - self._game.drop_bonus(self.state.x, self.state.y, 0, end_pos=None) #TODO: find the formula - self.state.lives -= 1 + self._game.drop_bonus(self.state.x, self.state.y, 0, + end_pos=(self._game.prng.rand_double() * 288 + 48, + self._game.prng.rand_double() * 192 - 64)) + for i in range(16): - self._game.new_particle((self.state.x, self.state.y), 0, 4., 256) + self._game.new_particle((self.state.x, self.state.y), 0, 4., 256) #TODO: find the real size and range. elif time == 7: self._sprite.mirrored = False