comparison pytouhou/game/game.py @ 165:c8c60291c56f

Implement item dropping by enemies.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 18 Oct 2011 07:35:02 -0700
parents 5271789c067d
children dcf32488a2c9
comparison
equal deleted inserted replaced
164:5271789c067d 165:c8c60291c56f
53 self.ecl_runner = ECLMainRunner(ecl, self) 53 self.ecl_runner = ECLMainRunner(ecl, self)
54 54
55 55
56 def drop_bonus(self, x, y, _type): 56 def drop_bonus(self, x, y, _type):
57 player = self.players[0] #TODO 57 player = self.players[0] #TODO
58 if _type > 6:
59 return
58 item_type = self.item_types[_type] 60 item_type = self.item_types[_type]
59 item = Item((x, y), item_type, self) 61 item = Item((x, y), item_type, self)
60 self.items.append(item) 62 self.items.append(item)
61 63
62 64
188 # TODO: was_visible thing 190 # TODO: was_visible thing
189 self.bullets = [bullet for bullet in self.bullets if bullet.is_visible(384, 448)] 191 self.bullets = [bullet for bullet in self.bullets if bullet.is_visible(384, 448)]
190 self.cancelled_bullets = [bullet for bullet in self.cancelled_bullets if bullet.is_visible(384, 448)] 192 self.cancelled_bullets = [bullet for bullet in self.cancelled_bullets if bullet.is_visible(384, 448)]
191 self.players_bullets = [bullet for bullet in self.players_bullets if bullet.is_visible(384, 448)] 193 self.players_bullets = [bullet for bullet in self.players_bullets if bullet.is_visible(384, 448)]
192 194
195 # Filter out-of-scren items
196 self.items = [item for item in self.items if item.y < 448]
197
193 # Disable boss mode if it is dead/it has timeout 198 # Disable boss mode if it is dead/it has timeout
194 if self.boss and self.boss._removed: 199 if self.boss and self.boss._removed:
195 self.boss = None 200 self.boss = None
196 201