diff --git a/game.py b/game.py index 91e18e9..215bc9e 100644 --- a/game.py +++ b/game.py @@ -19,8 +19,6 @@ class Game(gameUtils.Game): # Don't remove this. It does important things. :3 super().__init__(*args, **kwargs) - # TODO: Add a random delay between the spin and fire - # TODO: Utiles the following new sounds: # gun-load: Should be played at the beginning of the game, # and should have an animation accompanying it. @@ -80,15 +78,18 @@ class Game(gameUtils.Game): self.playSound(self.gunShot) elif event.key == pygame.K_3: self.playSound(self.gunSpin) - elif event.key == pygame.K_SPACE: + elif event.key == pygame.K_SPACE and not self.awaitingTimeout("FireDelay"): self.gun.playAnim('spin') elif event.type == gameUtils.AnimStart: if event.objectID == self.gun.objectID and event.animationID == 'spin': self.playSound(self.gunSpin) elif event.type == gameUtils.AnimFinish: if event.objectID == self.gun.objectID and event.animationID == 'spin': - self.shockScale += self.fire() #check if the user gets shot - self.shockScale = min(self.shockScale, 1) #keeps shockScale in bounds + self.timeout("FireDelay",randint(0,2000)/1000) + + elif event.type == gameUtils.Timeout: + self.shockScale += self.fire() #check if the user gets shot + self.shockScale = min(self.shockScale, 1) #keeps shockScale in bounds def update(self): """