user940982
user940982

Reputation: 5

Java game: Keeping framerate the same on all computers

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) whereas my computer stays at the perfect 33.

Is there a common problem with timers I'm missing here? Thanks.

Upvotes: 0

Views: 472

Answers (3)

trashgod
trashgod

Reputation: 205875

Use javax.swing.Timer, as shown in this AnimationTest.

Upvotes: 1

Jasoneer
Jasoneer

Reputation: 2088

Time Based Animation is what you want to be looking at.

Upvotes: 1

Oscar Gomez
Oscar Gomez

Reputation: 18488

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.

Upvotes: 4

Related Questions