fix tick method running at the reciprocal of TPS
This commit is contained in:
parent
686f6c26e2
commit
68c60a2245
1 changed files with 3 additions and 2 deletions
|
@ -26,7 +26,6 @@ public class Game extends ApplicationAdapter {
|
|||
private final static int TICKS_PER_SECOND = 60;
|
||||
private double tickProgress = 0;
|
||||
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
batch = new SpriteBatch();
|
||||
|
@ -40,11 +39,13 @@ public class Game extends ApplicationAdapter {
|
|||
|
||||
public void tick() {
|
||||
actors.forEach(Actor::tick);
|
||||
|
||||
dice.forEach(Die::roll);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
tickProgress += Gdx.graphics.getDeltaTime() / TICKS_PER_SECOND;
|
||||
tickProgress += Gdx.graphics.getDeltaTime() * TICKS_PER_SECOND;
|
||||
while (tickProgress >= 1) { //tick as many times as needed
|
||||
tick();
|
||||
tickProgress--;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue