cars_passed += 1 print(f"The number of cars on the highway: {cars_passed}") if john.reach_finish(): screen.update() screen.ontimer(john.new_level(), 300) level.increase_level() if DIFFICULTY_FACTOR > 130: DIFFICULTY_FACTOR = DIFFICULTY_FACTOR * 0.95 speed += 1 print(f"Current difficulty is {DIFFICULTY_FACTOR}") time.sleep(0.04) screen.update() for i in range(len(TRAFFIC)): TRAFFIC[i].move(speed) #Detect collision if TRAFFIC[i].distance(0, john.ycor()) < 35: game = GameOver(cars_passed) john.death() game_over = True if len(TRAFFIC) > 50: del TRAFFIC[:-50] if cars_passed > 8: allow_move() screen.update() screen.exitonclick()