public void movement(String left, String right, String up, String down, int speed, int turnspeed) //#The variables can be changed dependent on the user input on the players.
{
if (Greenfoot.isKeyDown(left)){ //#When the variable for left is placed it starts this statement.
turn(-turnspeed); //#Moves at set speed from the varialbe.
}
if (Greenfoot.isKeyDown(right)){ //#When the variable for right is placed it starts this statement.
turn(turnspeed); //#Moves at set speed from the varialbe.
}
if (Greenfoot.isKeyDown(down)){ //#When the variable for down is placed it starts this statement.
if (this.isTouching(Wall.class)){ //#If touching the wall does this segment.
move(speed); //#Moves 0
} else { //#If not touching wall does this segment.
move(-speed); //#Moves at set speed from the varialbe.
}
}
if (Greenfoot.isKeyDown(up)){ //#If deisgnated button pressed (W or Up) if starts.
if (this.isTouching(Wall.class)){ //#If touching the wall does this segment.
move(-speed); //#Moves -5
} else { //#If not touching wall does this segment.
move(speed); //#Moves at set speed from the varialbe.
}
}
}

