diff --git a/main.py b/main.py index 68ce4e3..29fe454 100644 --- a/main.py +++ b/main.py @@ -70,7 +70,7 @@ def init_sounds(): case_images = {} -def is_snap_event(event): +def is_SPACE_event(event): global touch_start # Tastatur oder Joystick A @@ -458,8 +458,7 @@ async def show_instruction_screen(image): if event.type == pygame.QUIT: pygame.quit() sys.exit() - elif (event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE) or \ - (event.type == pygame.JOYBUTTONDOWN and event.button == 0): + elif is_SPACE_event(event): waiting = False async def fail_current_case(): @@ -608,10 +607,7 @@ async def show_game_over(score): if event.type == pygame.QUIT: pygame.quit() sys.exit() - elif ( - (event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE) or - (event.type == pygame.JOYBUTTONDOWN and event.button == 0) - ): + elif is_SPACE_event(event): if ready_to_submit and prepared_form: print("Benutzer bestÃĪtigt, Punkte werden jetzt gesendet.") prepared_form.submit() @@ -695,7 +691,7 @@ async def main(): stacked_cases.append(current_case) spawn_case_in_game() shake_timer = 10 - elif is_snap_event(event): + elif is_SPACE_event(event): if current_case and current_case.allow_snap: await current_case.animate_snap() can_use_tilt = True