From 68693e1cff85ab04bcdb56341e2f3f549c14a940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Thu, 27 May 2021 11:45:53 +0200 Subject: [PATCH] fix: Player and Moon movement now independant of FPS --- core/src/sagittarius/model/Moon.java | 2 +- core/src/sagittarius/model/Player.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/sagittarius/model/Moon.java b/core/src/sagittarius/model/Moon.java index e8a53b6..1b90344 100644 --- a/core/src/sagittarius/model/Moon.java +++ b/core/src/sagittarius/model/Moon.java @@ -32,7 +32,7 @@ public class Moon extends Planet { @Override public void act(float dt) { - this.angle += 10.0f / this.altitude; + this.angle += 2000.0f / this.altitude * dt; this.setX(sun.getX() + this.altitude * MathUtils.cosDeg(this.angle)); this.setY(sun.getY() + this.altitude * MathUtils.sinDeg(this.angle)); super.act(dt); diff --git a/core/src/sagittarius/model/Player.java b/core/src/sagittarius/model/Player.java index 95e75dd..e143da5 100644 --- a/core/src/sagittarius/model/Player.java +++ b/core/src/sagittarius/model/Player.java @@ -91,10 +91,10 @@ public class Player extends EntityQuad { if (active) { if (Gdx.input.isKeyPressed(SagittariusGame.moveLeftKey)) { - this.angle += 100.0f / home.getRadius(); + this.angle += 10000.0f / home.getRadius() * dt; } if (Gdx.input.isKeyPressed(SagittariusGame.moveRightKey)) { - this.angle -= 100.0f / home.getRadius(); + this.angle -= 10000.0f / home.getRadius() * dt; } }