Hi, im trying to set the location of my test character called test(), after switching worlds. I do this by letting the test character touch the HappyPortal() class to switch to the happy world and i use the StartPortal() class to twitch back to the starting world called MyWorld. I tried using the setLocation(); command, but somehow the test object is at the start location after switching back to starting world from the happy world. Can someone help me with this???
1 2 3 4 5 6 7 8 9 | public void switching(){ if (isTouching(HappyPortal. class )){ Greenfoot.setWorld( new NewWorld2()); } if (isTouching(StartPortal. class )) { Greenfoot.setWorld( new MyWorld()); setLocation( 100 , 200 ); } } |