From 4ea04b1ade938d4ba2f972b6bc2caa5ed919e1af Mon Sep 17 00:00:00 2001 From: pascald Date: Sat, 3 May 2025 00:35:01 +0200 Subject: [PATCH] final changes for better touch function --- main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.py b/main.py index e8e64da..561e538 100644 --- a/main.py +++ b/main.py @@ -76,6 +76,7 @@ case_images = {} 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() @@ -86,6 +87,7 @@ def touch(event): duration = time.time() - touch_start_time dx = end[0] - touch_start[0] dy = end[1] - touch_start[1] + print(f"Touch dx={dx}, dy={dy}, duration={duration}") touch_start = None touch_start_time = None @@ -98,6 +100,8 @@ def touch(event): return "ontop" else: return None + + return None def is_SPACE_event(event):