Search code examples
libgdx2d-games

2d games - It is safe to leave dealing with delta time on animation games especially with libgdx engine


i'm new to games development

in 2d games i'm using a final delta time for all frames and for measuring speed and so on;

i want to know if there is a problem can happen when i use final delta time instead of use counted-by-engine delta time

and also where to use the final delta and where to use the counted one

like game in game.java

class game extends com.badlogic.gdx.Game {

    final float delta = 1 / 60F;

    @Override
    public void create() {
    }


    @Override
    public void render() {
        if (screen != null) screen.render(delta);
        /////////// do stuff Depended on final delta
        player.translate(150, delta)
    }
}

thanks :)


Solution

  • Why not just use Gdx.Graphics.getDeltaTime()? The value is approximately 60, but I often see it ranging from 59 to 61.

    Meant this as a comment, sorry.