Return to repo list

gatemender

Arcade game about fixing warp gates. LibreJam Dec 2020 Entry.
Return to HMagellan.com

commit 9bab819442ba4666c1678d8f6e06c5f50605118b
parent 38d0d33ab4061a0517897f8208a065a882119288
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Mon, 14 Dec 2020 17:41:54 -0600

Can now start game from main menu with keys

Diffstat:
Msrc/constants.py | 8+++++---
Msrc/game.py | 2++
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/constants.py b/src/constants.py @@ -8,9 +8,10 @@ CONTROLS = { "SHOOT_KEY" : pygame.K_SPACE, "THRUST_KEY" : pygame.K_w, "REPAIR_KEY" : pygame.K_e, - "BURST_KEY" : pygame.K_k + "BURST_KEY" : pygame.K_k, + "CONFIRM_KEY" : pygame.K_RETURN } -# Example alternative config from glw@linuxmail.org from here: https://leagueh.xyz/mail/hyperkitty/list/librejam@leagueh.xyz/message/64Y5OV2BSFRSTZTEORBDI4ZMEYDQ6346/ +# Example alternative config adapted from glw@linuxmail.org from here: https://leagueh.xyz/mail/hyperkitty/list/librejam@leagueh.xyz/message/64Y5OV2BSFRSTZTEORBDI4ZMEYDQ6346/ #CONTROLS = { # "TURN_LEFT_KEY" : pygame.K_LEFT, # "TURN_RIGHT_KEY" : pygame.K_RIGHT, @@ -18,7 +19,8 @@ CONTROLS = { # "SHOOT_KEY" : pygame.K_SPACE, # "THRUST_KEY" : pygame.K_UP, # "REPAIR_KEY" : pygame.K_RETURN, -# "BURST_KEY" : pygame.K_k +# "BURST_KEY" : pygame.K_k, +# "CONFIRM_KEY" : pygame.K_z #} # HIGHSCORE diff --git a/src/game.py b/src/game.py @@ -239,6 +239,8 @@ class Game(object): self.ship.fixing = self.keys[CONTROLS["REPAIR_KEY"]] self.ship.bursting = self.keys[CONTROLS["BURST_KEY"]] elif self.mode == MODES.Menu: + if self.keys[CONTROLS["CONFIRM_KEY"]] or self.keys[CONTROLS["SHOOT_KEY"]]: + self.change_mode(MODES.Transition) if pygame.mouse.get_pressed()[0]: mousepos = pygame.mouse.get_pos() if not self.show_info: