I'm making a racing game and want to make the car look like its switching lanes, i want it to turn right but still move in the X axis. I've tried something like this and it turns the car but the car moves to its right, in other words, the car is doing full circles.
I want the car to be moving in the X axis (West to east and vice versa) no matter which way the car is facing.
I've also tried but the car glitches out and appears as 2 images.
Thanks in Advance.
if (Greenfoot.isKeyDown("left") && getRotation() != 340)
{
turn (-5);
move(-5);
}
if (Greenfoot.isKeyDown("right") && getRotation() != 20)
{
turn(5);
move(5);
}setLocation(getY(), getX()+5);