I am creating a character which moves, it moves upwards fine but when it moves side ways it is extremly slow. Here is the movement code:
p.getPosition().y += playerSpeed;
This is the code for handling input:
World world;
Player p;
WorldHandler wh;
public boolean touchUp(int screenX, int screenY, int pointer, int button)
{
p = world.getPlayer();
wh = new WorldHandler(world);
if(screenX >= Gdx.graphics.getWidth() / 2) // Right side of the screen
{
p.getVel().x = wh.playerSpeed;
}
if(screenX <= Gdx.graphics.getWidth() / 2) // Left side of the screen
{
p.getVel().x = -wh.playerSpeed;
}
return false;
}
Thanks for any help! :)