animation technique?
I have been looking through animation examples and am interested to find two methods of creating a simple animation. One way is shown to use Timers to schedule a repaint call, the other is to create a new thread and use that to repaint the JFrame over so many milliseconds. I have seen the use of both and the need to override the update method. Some please explain why each one is used the way it is and for simplicity sake, what is the most straightforward way to incorporate in my falldown game.
# 1
A Timer pretty much is a separate Thread (or maybe it contains the thread, idk how to say it) The Timer does all the nice junk of timing and stuff (with Threads u might have to write ur own timing method, etc). basically, use a javax.swing.Timer.
# 2
You can use a Timer and schedule events, but that's a finicky (and slow) way of animating a game.
I would research more into something called "active painting".
Basically, your entire game will run inside a loop, like so:
while(true)
{
updateGameLogic();
paintToScreen();
}
Good luck on your game
-Cuppo