diff 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
line wrap: on
line diff
--- a/pytouhou/game/game.py
+++ b/pytouhou/game/game.py
@@ -46,6 +46,7 @@ class Game(object):
         self.lasers = []
         self.cancelled_bullets = []
         self.players_bullets = []
+        self.players_lasers = [None, None]
         self.items = []
 
         self.stage = stage
@@ -83,6 +84,10 @@ class Game(object):
         return []
 
 
+    def lasers_sprites(self):
+        return [laser for laser in self.players_lasers if laser]
+
+
     def modify_difficulty(self, diff):
         self.difficulty_counter += diff
         while self.difficulty_counter < 0:
@@ -236,6 +241,10 @@ class Game(object):
         for bullet in self.bullets:
             bullet.update()
 
+        for laser in self.players_lasers:
+            if laser:
+                laser.update()
+
         for item in self.items:
             item.update()
 
@@ -315,6 +324,9 @@ class Game(object):
                             if not bullet._removed]
         self.players_bullets = [bullet for bullet in self.players_bullets
                             if not bullet._removed]
+        for i, laser in enumerate(self.players_lasers):
+            if laser and laser._removed:
+                self.players_lasers[i] = None
         self.cancelled_bullets = [bullet for bullet in self.cancelled_bullets
                             if not bullet._removed]
         self.effects = [effect for effect in self.effects if not effect._removed]