diff --git a/main.py b/main.py index 865682f..984929d 100644 --- a/main.py +++ b/main.py @@ -73,10 +73,9 @@ def init_sounds(): case_images = {} -def touch(event): +async def touch(event): global touch_start, touch_start_time - if event.type == pygame.FINGERDOWN and not touch_start: touch_start = (event.x * SCREEN_WIDTH, event.y * SCREEN_HEIGHT) touch_start_time = time.time() @@ -503,7 +502,7 @@ async def show_instruction_screen(image): if event.type == pygame.QUIT: pygame.quit() sys.exit() - elif is_SPACE_event(event) or touch(event) == "snap": + elif is_SPACE_event(event) or await touch(event) == "snap": waiting = False async def fail_current_case(): @@ -652,7 +651,7 @@ async def show_game_over(score): if event.type == pygame.QUIT: pygame.quit() sys.exit() - elif is_SPACE_event(event) or touch(event) == "snap": + elif is_SPACE_event(event) or await touch(event) == "snap": if ready_to_submit and prepared_form: print("Benutzer bestÃĪtigt, Punkte werden jetzt gesendet.") prepared_form.submit() @@ -713,7 +712,7 @@ async def main(): if state == 1: # PLAYING result = None if pygame.FINGERUP and touch_start: - result = touch(event) + result = await touch(event) if is_LEFT_event(event) or result == "ontop": can_tip = current_case.length_units * UNIT_HEIGHT <= TRAILER_HEIGHT