COMPLETE EDIT:
After reading comments, I changed to a Timer with Timer(33,this);, however on my laptop it's repeating at 47 (and constantly bouncing around to other numbers) whe开发者_Go百科reas my computer stays at the perfect 33.
Is there a common problem with timers I'm missing here? Thanks.
I dont think you are taking the right approach, you shouldn't try to keep all the computers running at the same FPS, in fact no game that I know does that. Instead you should make sure that every x fraction of time the same movements happen regardless of the fps for that particular computer.
Time Based Animation is what you want to be looking at.
Use javax.swing.Timer
, as shown in this AnimationTest
.
精彩评论