Commits

sirchristian committed a7a375c

Fixed a bug and made bullets faster

  • Participants
  • Parent commits 2b2f398

Comments (0)

Files changed (2)

             for b,bullet in ship.bullets:
                 # see if any of the bullets hit
                 if doRectsOverlap(baddie.rect, bullet):
-                    # on a hit remove the baddie
-                    badGuySprites.remove(baddie)
-                    baddies.remove(baddie)
+                    # on a hit remove the baddie if they are still there
+                    if badGuySprites.__contains__(baddie):
+                        badGuySprites.remove(baddie)
+                    if baddies.__contains__(baddie):
+                        baddies.remove(baddie)
 
         # update the display
         badGuySprites.draw(gameSurface)

File shipSprite.py

             self.rect.move_ip(-1, 0)
         if keys[K_RIGHT] and self.rect.right < self.gameRect.right:
             self.rect.move_ip(1, 0)
-        if keys[K_SPACE] and (now - self.lastFire).total_seconds() >= 0.25:
+        if keys[K_SPACE] and (now - self.lastFire).total_seconds() >= 0.1:
             self._fire(now)
 
     def _fire(self, now):