Mercurial > touhou
comparison pytouhou/game/item.py @ 304:f3099ebf4f61
Update attribute names to reflect the actual interface.
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Tue, 13 Mar 2012 18:38:14 +0100 |
parents | 3ac8b135592c |
children | 52d791bb7c32 |
comparison
equal
deleted
inserted
replaced
303:647bde10353d | 304:f3099ebf4f61 |
---|---|
19 | 19 |
20 | 20 |
21 class Item(object): | 21 class Item(object): |
22 def __init__(self, start_pos, _type, item_type, game, angle=pi/2, player=None, end_pos=None): | 22 def __init__(self, start_pos, _type, item_type, game, angle=pi/2, player=None, end_pos=None): |
23 self._game = game | 23 self._game = game |
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.frame = 0 | 29 self.frame = 0 |
30 self.x, self.y = start_pos | 30 self.x, self.y = start_pos |
43 end_pos, 60) | 43 end_pos, 60) |
44 else: | 44 else: |
45 self.speed_interpolator = Interpolator((-2.,), 0, | 45 self.speed_interpolator = Interpolator((-2.,), 0, |
46 (0.,), 60) | 46 (0.,), 60) |
47 | 47 |
48 self._sprite.angle = angle | 48 self.sprite.angle = angle |
49 | 49 |
50 | 50 |
51 def autocollect(self, player): | 51 def autocollect(self, player): |
52 self.player = player | 52 self.player = player |
53 self.speed = player.sht.autocollection_speed | 53 self.speed = player.sht.autocollection_speed |
113 | 113 |
114 if score > 0: | 114 if score > 0: |
115 #TODO: display the score. | 115 #TODO: display the score. |
116 player_state.score += score | 116 player_state.score += score |
117 | 117 |
118 self._removed = True | 118 self.removed = True |
119 | 119 |
120 | 120 |
121 def update(self): | 121 def update(self): |
122 if self.frame == 60: | 122 if self.frame == 60: |
123 self.speed_interpolator = Interpolator((0.,), 60, | 123 self.speed_interpolator = Interpolator((0.,), 60, |