From 68c60a22450646c2bfe174c4c579d74b5fd828ff Mon Sep 17 00:00:00 2001 From: James <150948866+jameslaight@users.noreply.github.com> Date: Sat, 20 Apr 2024 16:01:31 +0100 Subject: [PATCH] fix tick method running at the reciprocal of TPS --- core/src/com/monjaro/gamejam/Game.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/monjaro/gamejam/Game.java b/core/src/com/monjaro/gamejam/Game.java index 1afdb46..01a4593 100644 --- a/core/src/com/monjaro/gamejam/Game.java +++ b/core/src/com/monjaro/gamejam/Game.java @@ -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--;