comparison pytouhou/game/item.py @ 229:5afc75f71fed

Add “SHT” support to EoSD, and do a little cleanup.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 30 Dec 2011 18:37:06 +0100
parents 0595315d3880
children 3ac8b135592c
comparison
equal deleted inserted replaced
228:8f4cd1c01d22 229:5afc75f71fed
24 self._sprite = item_type.sprite 24 self._sprite = item_type.sprite
25 self._removed = False 25 self._removed = False
26 self._type = _type 26 self._type = _type
27 self._item_type = item_type 27 self._item_type = item_type
28 28
29 self.hitbox_half_size = item_type.hitbox_size / 2.
30
31 self.frame = 0 29 self.frame = 0
32 self.x, self.y = start_pos 30 self.x, self.y = start_pos
33 self.angle = angle 31 self.angle = angle
34 32
35 if player: 33 if player:
50 self._sprite.angle = angle 48 self._sprite.angle = angle
51 49
52 50
53 def autocollect(self, player): 51 def autocollect(self, player):
54 self.player = player 52 self.player = player
55 self.speed = player.sht.autocollection_speed if hasattr(player, 'sht') else 8. 53 self.speed = player.sht.autocollection_speed
56 54
57 55
58 def on_collect(self, player): 56 def on_collect(self, player):
59 player_state = player.state 57 player_state = player.state
60 old_power = player_state.power 58 old_power = player_state.power
82 player_state.score += score 80 player_state.score += score
83 self._game.modify_difficulty(+1) 81 self._game.modify_difficulty(+1)
84 82
85 elif self._type == 1: # point 83 elif self._type == 1: # point
86 player_state.points += 1 84 player_state.points += 1
87 poc = player.sht.point_of_collection if hasattr(player, 'sht') else 128 #TODO: find the exact poc in EoSD. 85 poc = player.sht.point_of_collection
88 if player_state.y < poc: 86 if player_state.y < poc:
89 score = 100000 87 score = 100000
90 self._game.modify_difficulty(+30) 88 self._game.modify_difficulty(+30)
91 else: 89 else:
92 score = 0 #TODO: find the formula. 90 score = 0 #TODO: find the formula.