Hello, I am trying to create an instance where after my character collects all of the keys placed on the screen it can enter a door which when the character touches the door will take them to level 2.
public class Door extends Actor
{
public void act()
{
if(getOneIntersectingObject(Character.class) && getWorld().getObjects(Key.class).isEmpty())
{
Level2 world = new Level2();
Greenfoot.setWorld(world);
}
}
}if(getOneIntersectingObject(Character.class)!= null && getWorld().getObjects(Key.class).isEmpty())
public class Door extends Actor {
public void act() {
if (isTouching(Character.class) && getWorld().getObjects(Key.class).isEmpty())
Greenfoot.setWorld(new Level2());
}
}if(getOneIntersectingObject(Character.class)!= null && getWorld().getObjects(Key.class).isEmpty())