Hello I have a game with stages in it. when my actor hits the target i want to set his location to another world. For example the actor is in myWorld and i want to set his position to myWorldStage2. How do I do That?


World ws2=new myWorldStage2(); ws2.addObject(actor, 10, 200); Greenfoot.setWorld(ws2);
public void nextLevel() { if (getOneObjectAtOffset(0, getImage().getHeight()/2, portal.class) != null) { World world2 = new myWorldStage2(); world2.addObject(this, 10, 200); Greenfoot.setWorld(world2); } }
public void nextLevel() { if (getOneObjectAtOffset(0, 0, portal.class) != null) { World world2 = new myWorldStage2(); world2.addObject(this, 10, 200); Greenfoot.setWorld(world2); } }