LuposX / LetsCreateGame

My Classmates and Me are trying to create a 2d-game
MIT License
3 stars 1 forks source link

Add a timer #23

Open LuposX opened 4 years ago

LuposX commented 4 years ago

Lets you see how long much time you needed for finishing the level. Helpfull for speedrunners

LuposX commented 4 years ago

Timer: https://www.techiedelight.com/measure-elapsed-time-execution-time-java/

Understanding threads: https://www.javaworld.com/article/2074217/java-101--understanding-java-threads--part-1--introducing-threads-and-runnables.html

Start a new thread for it:

thread = new Thread(new Timer(startTime)); //create a thread with input paramter the function that should get executed
thread.start();  // start thread

thread.stop(); // stop it