I want to make this block of code be executed every 20 seconds:
increasing the speed of the ball
This is the IF-statement that this code comes from:
the if-statement for my Ping Pong game; with each collision, the ball goes faster
I tried using TimerTask:
using the TimerTask() class to iterate the block of code that increases the ball’s speed, every 20 seconds
I expected the block of code in the public void run() method to be executed every 20 seconds but happened instead is that immediately, the ball moves very fast and after some time, I get a lot of errors with ‘os warning’:
the Exception errors
[warning][os thread]
Yash Pingale is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.