final changes for better touch function

This commit is contained in:
2025-05-03 02:14:00 +02:00
parent f59b0895bb
commit f5580a6eda

View File

@@ -80,7 +80,7 @@ async def touch(event):
touch_start = (event.x * SCREEN_WIDTH, event.y * SCREEN_HEIGHT) touch_start = (event.x * SCREEN_WIDTH, event.y * SCREEN_HEIGHT)
touch_start_time = time.time() touch_start_time = time.time()
print("touch_start") print("touch_start")
return False return "False"
elif event.type == pygame.FINGERUP and touch_start: elif event.type == pygame.FINGERUP and touch_start:
end = (event.x * SCREEN_WIDTH, event.y * SCREEN_HEIGHT) end = (event.x * SCREEN_WIDTH, event.y * SCREEN_HEIGHT)
@@ -101,8 +101,8 @@ async def touch(event):
return "ontop" return "ontop"
else: else:
print("touch problem") print("touch problem")
return False return "False"
return False return "False"
async def is_SPACE_event(event): async def is_SPACE_event(event):
@@ -651,7 +651,7 @@ async def show_game_over(score):
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
pygame.quit() pygame.quit()
sys.exit() sys.exit()
elif await is_SPACE_event(event) or await (touch(event) == "snap"): elif await is_SPACE_event(event) or (await touch(event) == "snap"):
if ready_to_submit and prepared_form: if ready_to_submit and prepared_form:
print("Benutzer bestätigt, Punkte werden jetzt gesendet.") print("Benutzer bestätigt, Punkte werden jetzt gesendet.")
prepared_form.submit() prepared_form.submit()