Right now i have just started a new game and i am controlling basic movement by this code:
if ((Gdx.input.isKeyPressed(Keys.W)))
levelY -= 5;
if ((Gdx.input.isKeyPressed(Keys.A)))
levelX += 5;
if ((Gdx.input.isKeyPressed(Keys.S)))
levelY += 5;
if ((Gdx.input.isKeyPressed(Keys.D)))
levelX -= 5;
Now when the keys aren’t pressed the motion stops instantly so I was wondering if there was some formula I could use to gradually slow the movement or maybe not even a formula just another way of doing this. I thought this would be a somewhat discussed subject but my Google searching hasn’t found anything. Thanks in advanced!