comparison pytouhou/game/game.py @ 294:94c636f8f863

Add player lasers for MarisaB.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 21 Feb 2012 14:28:38 +0100
parents ab618c2bbce8
children e04e402e6380
comparison
equal deleted inserted replaced
293:ab618c2bbce8 294:94c636f8f863
44 self.effects = [] 44 self.effects = []
45 self.bullets = [] 45 self.bullets = []
46 self.lasers = [] 46 self.lasers = []
47 self.cancelled_bullets = [] 47 self.cancelled_bullets = []
48 self.players_bullets = [] 48 self.players_bullets = []
49 self.players_lasers = [None, None]
49 self.items = [] 50 self.items = []
50 51
51 self.stage = stage 52 self.stage = stage
52 self.rank = rank 53 self.rank = rank
53 self.difficulty = difficulty 54 self.difficulty = difficulty
81 82
82 def msg_sprites(self): 83 def msg_sprites(self):
83 return [] 84 return []
84 85
85 86
87 def lasers_sprites(self):
88 return [laser for laser in self.players_lasers if laser]
89
90
86 def modify_difficulty(self, diff): 91 def modify_difficulty(self, diff):
87 self.difficulty_counter += diff 92 self.difficulty_counter += diff
88 while self.difficulty_counter < 0: 93 while self.difficulty_counter < 0:
89 self.difficulty -= 1 94 self.difficulty -= 1
90 self.difficulty_counter += 100 95 self.difficulty_counter += 100
234 bullet.update() 239 bullet.update()
235 240
236 for bullet in self.bullets: 241 for bullet in self.bullets:
237 bullet.update() 242 bullet.update()
238 243
244 for laser in self.players_lasers:
245 if laser:
246 laser.update()
247
239 for item in self.items: 248 for item in self.items:
240 item.update() 249 item.update()
241 250
242 for player in self.players: 251 for player in self.players:
243 if not player.state.touchable: 252 if not player.state.touchable:
313 # Filter out-of-scren bullets 322 # Filter out-of-scren bullets
314 self.bullets = [bullet for bullet in self.bullets 323 self.bullets = [bullet for bullet in self.bullets
315 if not bullet._removed] 324 if not bullet._removed]
316 self.players_bullets = [bullet for bullet in self.players_bullets 325 self.players_bullets = [bullet for bullet in self.players_bullets
317 if not bullet._removed] 326 if not bullet._removed]
327 for i, laser in enumerate(self.players_lasers):
328 if laser and laser._removed:
329 self.players_lasers[i] = None
318 self.cancelled_bullets = [bullet for bullet in self.cancelled_bullets 330 self.cancelled_bullets = [bullet for bullet in self.cancelled_bullets
319 if not bullet._removed] 331 if not bullet._removed]
320 self.effects = [effect for effect in self.effects if not effect._removed] 332 self.effects = [effect for effect in self.effects if not effect._removed]
321 333
322 # Filter “timed-out” lasers 334 # Filter “timed-out” lasers