I am making a maze game, how can I make my actor go to the start (specific x and y coordinates) when they touch the wall (which in this case is a png black outline under actor not world)
if (isTouching(Wall.class)) setLocation(specificX, specificY);
public void act()
{
movement();
checkWalls();
}
public void movement()
{
if(Greenfoot.isKeyDown("right")) move(3);
turn(90);
if(Greenfoot.isKeyDown("down")) move(3);
turn(90);
if(Greenfoot.isKeyDown("left")) move(3);
turn(90);
if(Greenfoot.isKeyDown("up")) move(3);
turn(90);
}
public void checkWalls()
{
if (isTouching(Maze1.class)) setLocation(481, 360);
}