What would the code be if I wanted to change my world if I'm in front one my actors and press a down key.
//In your world
public void teleport()
{
if (player.canTeleport() && Greenfoot.isKeyDown("down")) //You will need to have an instance variable of the player in the world
Greenfoot.setWorld(/*World you want to change to*/);
}
//Somewhere in the world constructor
setPaintOrder(Player.class, Teleporter.class);
//In your player
public boolean canTeleport() //Or "canChangeRooms" or whatever you want
{
return getIntersectingObject(Teleporter.class) != null; //Basically return true if the player is over a teleporter, false if there is nothing there.
}