Hey I'd like to add an object to a world while another world is active.
It doesn't seem to add it though, instead it adds it to the active world and removes it when I switch over to the other world
Code:
int difficulty = 0;
if (isTouching(Medium.class))
{
TouchingM = true;
if (Greenfoot.mousePressed(getWorld().getObjects(Medium.class).get(0)))
{
Greenfoot.setWorld(new PlantsVsZombies());
difficulty = 2;
getWorld().addObject(new Green(),500,500);
}
}
else{
TouchingM = false;
}
