I created the following code to make a car go around the scene/world. The car starts from the left, has to turn before touching the right Edge, go down, turn before touching the bottom Edge, and turn again to go up. Somehow I can't get the car to turn and go up. Any help appreciated.
public class Car2 extends Actor
{
/**
* Act - do whatever the Car2 wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{ move(2);
//if(getY()>510)
{
if(getX()>=510 & getY()<510)
{
setRotation(90);
setLocation(getX(), getY()+1);
}
if(getY()>510 & getX()>510)
{
setRotation(180);
setLocation(getX()-1, getY());
}
if(getX()==510 & getY()<510 & getY()>510)
{
setRotation(270);
setLocation(getX(), getY()-1);
}
}
}
}
