test for touch function

This commit is contained in:
2025-05-02 17:19:50 +02:00
parent 4e45c54fd3
commit cba84f8e07

12
main.py
View File

@@ -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