This code makes a character change to another world. In the other world is a portal which is calling the char back to the first world. If I use the portal overthere again, the char is not changing from world, but keeps coming up in the same world.
What's wrong? And is there a way to interact with a specific object instead of any object of that class, because four portals needs four different world-transitions.
Yours,
Dennis
public void checkForPortal(){
Actor portal = getOneObjectAtOffset(10, 10, Portal.class);
if(portal != null && Greenfoot.isKeyDown("up")){
if(getWorld() instanceof TrainingGround){
Greenfoot.setWorld(new Questmap());
}
if(getWorld() instanceof Questmap){
Greenfoot.setWorld(new TrainingGround());
}
}
}


