diff --git a/main.py b/main.py index b18604f..94c0843 100644 --- a/main.py +++ b/main.py @@ -702,14 +702,18 @@ async def main(): for event in pygame.event.get(): if event.type == pygame.QUIT: running = False - elif event.type == pygame.KEYDOWN or event.type == pygame.JOYBUTTONDOWN or event.type == pygame.JOYHATMOTION or event.type == pygame.FINGERDOWN or touch_start or(event.type == pygame.MOUSEBUTTONDOWN and event.button == 1): + elif event.type == pygame.KEYDOWN or event.type == pygame.JOYBUTTONDOWN or event.type == pygame.JOYHATMOTION or event.type == pygame.FINGERDOWN or touch_start or (event.type == pygame.MOUSEBUTTONDOWN and event.button == 1): if state == 1: # PLAYING - if is_LEFT_event(event) or touch(event) == "ontop": + if pygame.FINGERUP and touch_start: + result = touch(event) + else: + result = None + if is_LEFT_event(event) or result == "ontop": can_tip = current_case.length_units * UNIT_HEIGHT <= TRAILER_HEIGHT if current_case and current_case.allow_snap and can_use_tilt and can_tip: await current_case.animate_tip() can_use_tilt = False - elif is_UP_event(event) or touch(event) == "tilt": + elif is_UP_event(event) or result == "tilt": if current_case and current_case.allow_snap and can_use_on_top and current_case.can_place_on_top(): if await current_case.animate_place_on_top(): transition_counter = transition_fps @@ -726,7 +730,7 @@ async def main(): stacked_cases.append(current_case) spawn_case_in_game() shake_timer = 10 - elif is_SPACE_event(event) or touch(event) == "snap": + elif is_SPACE_event(event) or result == "snap": if current_case and current_case.allow_snap: await current_case.animate_snap() can_use_tilt = True