comparison pytouhou/game/game.py @ 161:7e7368356445

Add bullet cancel anim support
author Thibaut Girka <thib@sitedethib.com>
date Tue, 11 Oct 2011 11:29:33 +0200
parents 4684d311a32d
children 5271789c067d
comparison
equal deleted inserted replaced
160:606468ab4f7b 161:7e7368356445
34 self.characters = characters 34 self.characters = characters
35 35
36 self.players = [Player(player_state, characters[player_state.character]) for player_state in player_states] 36 self.players = [Player(player_state, characters[player_state.character]) for player_state in player_states]
37 self.enemies = [] 37 self.enemies = []
38 self.bullets = [] 38 self.bullets = []
39 self.cancelled_bullets = []
39 self.items = [] 40 self.items = []
40 41
41 self.stage = stage 42 self.stage = stage
42 self.rank = rank 43 self.rank = rank
43 self.difficulty = difficulty 44 self.difficulty = difficulty
76 self.ecl_runner.run_iter() 77 self.ecl_runner.run_iter()
77 78
78 # 2. Filter out destroyed enemies 79 # 2. Filter out destroyed enemies
79 self.enemies = [enemy for enemy in self.enemies if not enemy._removed] 80 self.enemies = [enemy for enemy in self.enemies if not enemy._removed]
80 self.bullets = [bullet for bullet in self.bullets if not bullet._removed] 81 self.bullets = [bullet for bullet in self.bullets if not bullet._removed]
82 self.cancelled_bullets = [bullet for bullet in self.cancelled_bullets if not bullet._removed]
81 self.items = [item for item in self.items if not item._removed] 83 self.items = [item for item in self.items if not item._removed]
82 84
83 # 3. Let's play! 85 # 3. Let's play!
84 #TODO: check update orders 86 #TODO: check update orders
85 for player in self.players: 87 for player in self.players:
95 97
96 for enemy in self.enemies: 98 for enemy in self.enemies:
97 enemy.update() 99 enemy.update()
98 100
99 for bullet in self.bullets: 101 for bullet in self.bullets:
102 bullet.update()
103
104 for bullet in self.cancelled_bullets:
100 bullet.update() 105 bullet.update()
101 106
102 for item in self.items: 107 for item in self.items:
103 item.update() 108 item.update()
104 109
159 self.enemies.remove(enemy) 164 self.enemies.remove(enemy)
160 165
161 # Filter out-of-scren bullets 166 # Filter out-of-scren bullets
162 # TODO: was_visible thing 167 # TODO: was_visible thing
163 self.bullets = [bullet for bullet in self.bullets if bullet.is_visible(384, 448)] 168 self.bullets = [bullet for bullet in self.bullets if bullet.is_visible(384, 448)]
169 self.cancelled_bullets = [bullet for bullet in self.cancelled_bullets if bullet.is_visible(384, 448)]
164 170
165 # Disable boss mode if it is dead/it has timeout 171 # Disable boss mode if it is dead/it has timeout
166 if self.boss and self.boss._removed: 172 if self.boss and self.boss._removed:
167 self.boss = None 173 self.boss = None
168 174