Made it possible to quit the game using CTRL + C.
This commit is contained in:
parent
042e5fa546
commit
5a04f262a4
1 changed files with 11 additions and 1 deletions
12
cowyeet.py
12
cowyeet.py
|
@ -279,16 +279,23 @@ def get_events():
|
|||
elif event.type == pygame.KEYDOWN:
|
||||
key = event.key
|
||||
|
||||
if key == pygame.K_SPACE:
|
||||
if key == pygame.K_c and pressed_special_keys & pygame.KMOD_CTRL:
|
||||
close()
|
||||
|
||||
elif key == pygame.K_SPACE:
|
||||
if page == "ingame":
|
||||
yeet_cow()
|
||||
|
||||
|
||||
def loop():
|
||||
global last_frame_mouse_pressed
|
||||
global pressed_keys
|
||||
global pressed_special_keys
|
||||
|
||||
screen.fill(nero)
|
||||
|
||||
pressed_keys = keyboard.get_pressed()
|
||||
pressed_special_keys = keyboard.get_mods()
|
||||
get_events()
|
||||
|
||||
if not running:
|
||||
|
@ -325,11 +332,14 @@ cow_flying = False
|
|||
cow_position = (0, 0)
|
||||
cow_flight_path = []
|
||||
cow_flight_step = 0
|
||||
pressed_keys = []
|
||||
pressed_special_keys = pygame.key.get_mods()
|
||||
|
||||
|
||||
# pygame objects
|
||||
clock = pygame.time.Clock() # misc
|
||||
mouse = pygame.mouse
|
||||
keyboard = pygame.key
|
||||
|
||||
bigger_default_font = pygame.font.SysFont("ubuntu", 32) # fonts
|
||||
|
||||
|
|
Loading…
Reference in a new issue