Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
fix: ⚙️remove the white dots when the ball is launched and can't long…
Browse files Browse the repository at this point in the history
…er launch the ball twice.
  • Loading branch information
Zentae committed Dec 8, 2022
1 parent cf0f919 commit 805fa43
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ball_release_event_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ def run(self, event, game):
# retrieve the placeholder ball.
placeholder_ball = game.get_window().get_element("placeholder_ball")
# check if the ball is at the same position
if abs(ball.get_x() - ball.get_initial_x()) < 15 and abs(ball.get_y() - ball.get_initial_y()) < 15:
if abs(ball.get_x() - ball.get_initial_x()) < 15 and abs(ball.get_y() - ball.get_initial_y()) < 15 or ball.is_released():
return
ball.set_released(True)
# disable ball.
placeholder_ball.set_visible(False)
# clear dots.
for i in range(20):
game.get_window().remove_element(("dot_",str(i)))
# launch new thread.
self.__t = StoppableThread(target=self.__move_ball, args=(game,))
# register the thread in order to be able to kill it.
Expand Down

0 comments on commit 805fa43

Please sign in to comment.