Apr-01-2020, 04:36 AM
I think the problem is clear if you put the stop_bomb_drop cod inside the __continue_bomb_drop func.
def __continue_bomb_drop(): global bomb_dropping, bomb_timer_id bomb.goto(bomb.xcor(), bomb.ycor() - 12) if bomb.ycor() < - height // 2 or bomb_collision(): bomb.hideturtle() screen.onkey(start_bomb_drop, "space") canvas.after_cancel(bomb_timer_id) bomb_timer_id = canvas.after(BOMB_DELAY, __continue_bomb_drop)Notice that even if you stop dropping the bomb you continue executing the __continue_bomb_drop. See what happens if you use an else statement so either you stop the bomb or you continue, not both.
def __continue_bomb_drop(): global bomb_dropping, bomb_timer_id bomb.goto(bomb.xcor(), bomb.ycor() - 12) if bomb.ycor() < - height // 2 or bomb_collision(): bomb.hideturtle() screen.onkey(start_bomb_drop, "space") canvas.after_cancel(bomb_timer_id) else: bomb_timer_id = canvas.after(BOMB_DELAY, __continue_bomb_drop)The second and subsequent bombs dropped faster because you are calling the continue twice as often. At first I was really confused by why each bomb didn't drop faster than the previous, but then I realized the way you stopped and started the bombs prevented more than two "timer loops" from forming. If you had don't this on purpose it would be a really clever bit of programming (hopefully with a lot of comments).