From 5b14f36770d053b3f3c49c3578137941059c7780 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 4 Jun 2015 12:19:22 +0100 Subject: [PATCH] modified OP keyboard shortcuts for OP. --- game.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/game.py b/game.py index b50c6dc..5fbd7fe 100644 --- a/game.py +++ b/game.py @@ -84,18 +84,7 @@ def play(window, options): temp.rect.y += 20 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: - Sounds["main"].stop() - Sounds["OP"].play(loops=-1) - player.OP = True - player.change_colour((255,96,0)) - elif player.OP: - Sounds["OP"].stop() - Sounds["main"].play(loops=-1) - player.OP = False - player.reset_image() + keys = pygame.key.get_pressed() if keys[pygame.K_RIGHT] or keys[pygame.K_d]: @@ -113,6 +102,22 @@ def play(window, options): if keys[pygame.K_r] and [pygame.K_9] and [pygame.K_k] and player.OP: eggs.r9k(window) + if keys[pygame.K_KP4] and keys[pygame.K_KP2] and keys[pygame.K_KP0] and keys[pygame.K_o] and keys[pygame.K_p] and not player.OP: + if player.options["Sounds"]: + Sounds["main"].stop() + Sounds["OP"].play(loops=-1) + player.OP = True + player.change_colour((255,96,0)) + logging.warn("OP mode engaged.") + + if keys[pygame.K_KP_MINUS] and player.OP: + if player.options["Sounds"]: + Sounds["OP"].stop() + Sounds["main"].play(loops=-1) + player.OP = False + player.reset_image() + logging.warn("OP mode disabled.") + for sprite in bullet_group: sprite.update() if sprite.rect.y < 0 or (sprite.rect.y > player.rect.y and sprite.type == "TARGET"):