Hello,
i have 2 worlds, MyWorld and World_1.
I also have 3 actors, Spieler, Glitz and Samen.
if Spieler is touching Glitz, i want to switch to World_1. I did that by writing in the Spieler actor class:
if (isTouching(Glitz.class)) {
Greenfoot.setWorld(new World_1());
}
and that worked, now after Samen reaches a location in World_1 I want to switch back to MyWorld
What a wrote to do that in the Samen actor class:
if (getX() == X && getY() == Y) { // X and Y certain locations in World_1
Greenfoot.setWorld(new MyWorld());
}
this create a new MyWorld but I want to return to the previous world.
Thanks.