From 43883a0ee235cb8be83e7f2d86211623d6fced6e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 12 May 2015 22:49:15 +0100 Subject: [PATCH] Made shooting with multiple buttons --- game.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/game.py b/game.py index a320ce5..b525a2e 100644 --- a/game.py +++ b/game.py @@ -68,16 +68,18 @@ def play(window, options): while PLAYING_GAME: window.fill((0,0,0)) + fired = False for event in pygame.event.get(): if event.type == pygame.QUIT: logging.critical("Exiting Game...") PLAYING_GAME = False return "QUIT" - if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE: + if event.type == pygame.KEYDOWN and event.key in [pygame.K_SPACE, pygame.K_w, pygame.K_UP] and not fired: if not player.options["Sounds"]: Sounds["shot"].play() temp = Bullet(player, player.options["Textures"]) bullet_group.add(temp) + fired = True if event.type == pygame.KEYDOWN and event.key == pygame.K_KP_PLUS: if not player.options["Sounds"] or not player.OP: