0

I'm creating a game. It does not use pygame but just Tkinter. It's basically a game which the player has to dodge some obstacles and last as long as possible so I'm trying to keep track of how long the player has survived. How could I write this code?

1 Answers1

0

A simple way is to store the time when the player spawns and then compare it to the time when the player object is destroyed.

spawn_time = time.time()
(game loop)
death_time = time.time()
survived_time = death_time-spawn_time
oxrock
  • 643
  • 5
  • 12