comparison pytouhou/game/player.py @ 197:e1bc8c4cbb1a

Do the right action when collecting an item.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 30 Oct 2011 11:29:08 -0700
parents 1e501e3b6645
children 13918723d1bc
comparison
equal deleted inserted replaced
196:1e501e3b6645 197:e1bc8c4cbb1a
38 self.x = 192.0 38 self.x = 192.0
39 self.y = 384.0 39 self.y = 384.0
40 40
41 self.invulnerable_time = 240 41 self.invulnerable_time = 240
42 self.touchable = True 42 self.touchable = True
43
44 self.power_bonus = 0 # Never goes over 30.
43 45
44 46
45 class Player(object): 47 class Player(object):
46 def __init__(self, state, game, anm_wrapper, speed=4., hitbox_size=2.5, graze_hitbox_size=42.): 48 def __init__(self, state, game, anm_wrapper, speed=4., hitbox_size=2.5, graze_hitbox_size=42.):
47 self._sprite = None 49 self._sprite = None
91 if not self.state.invulnerable_time and not self.death_time and self.state.touchable: # Border Between Life and Death 93 if not self.state.invulnerable_time and not self.death_time and self.state.touchable: # Border Between Life and Death
92 self.death_time = self._game.frame 94 self.death_time = self._game.frame
93 self._game.new_death((self.state.x, self.state.y), 2) 95 self._game.new_death((self.state.x, self.state.y), 2)
94 for i in range(16): 96 for i in range(16):
95 self._game.new_particle((self.state.x, self.state.y), 2, 4., 256) #TODO: find the real size and range. 97 self._game.new_particle((self.state.x, self.state.y), 2, 4., 256) #TODO: find the real size and range.
96
97
98 def collect(self, item):
99 #TODO
100 self.state.score += item._item_type.score
101 item._removed = True
102 98
103 99
104 def update(self, keystate): 100 def update(self, keystate):
105 if self.death_time == 0 or self._game.frame - self.death_time > 60: 101 if self.death_time == 0 or self._game.frame - self.death_time > 60:
106 try: 102 try: