Yet another question, sorry guy!
I want to drive a car around the screen but I can't get the car to only move in the direction that the front is facing. I really don't know how to set the direction that the car moves. I tried using some trigonometry to set the direction but setLocation would only take an int. It's been driving me crazy for hours! Here's what I have:
move(1);
if (Greenfoot.isKeyDown("left") ) {
setLocation (getX()-3, getY());
turn(-3);
}
if (Greenfoot.isKeyDown("right") ) {
setLocation (getX()+3, getY());
turn(3);
}
if (Greenfoot.isKeyDown("up") ) {
setLocation (getX(), getY()-3);
move(-3);
}
if (Greenfoot.isKeyDown("down") ) {
setLocation (getX(), getY()+3);
move(3);
}
