Rotate at a frame time dependent rate (300 degrees / second)

This commit is contained in:
Matt Low 2020-01-24 17:39:22 +04:00
parent 3d9b62d455
commit 83113f3afd

View File

@ -31,11 +31,11 @@ public class PlayerInputSystem extends EntitySystem {
AccelerationComponent accelComponent = entity.getComponent(AccelerationComponent.class); AccelerationComponent accelComponent = entity.getComponent(AccelerationComponent.class);
if (Gdx.input.isKeyPressed(Input.Keys.D)) { if (Gdx.input.isKeyPressed(Input.Keys.D)) {
positionComponent.rotation = Utils.rotate(positionComponent.rotation, -5); positionComponent.rotation = Utils.rotate(positionComponent.rotation, -300 * dt);
} }
if (Gdx.input.isKeyPressed(Input.Keys.A)) { if (Gdx.input.isKeyPressed(Input.Keys.A)) {
positionComponent.rotation = Utils.rotate(positionComponent.rotation, 5); positionComponent.rotation = Utils.rotate(positionComponent.rotation, 300 * dt);
} }
Vector2 acceleration = accelComponent.acceleration; Vector2 acceleration = accelComponent.acceleration;