Super_Hippo wrote...
Ah, I know why. Hm, you could try to remove all 'return' in the act method.public class Worldbackground extends World { public ImgScroll scroller; private Player_Test1 player_test1; /** * Sets Worldbackground's image size to be 3840 x 2160 with a cell size of 1. * prepare method is executed. */ public Worldbackground() { super(1920, 1080, 1, false); prepare(); scroller = new ImgScroll(this, new GreenfootImage("Worldbackground.jpg"), 3840, 2160); } /** * Speed of scenario is assigned to 65. * BgMusic class is assigned to play background music. * When "r" is pressed the World class will reload the Worldbackground class so that all World objects return to saved coordinates. */ public void act() { Greenfoot.setSpeed(65); BgMusic.play(); scroller.scroll(getWidth()/2-player_test1.getX(), getHeight()/2-player_test1.getY()); if (Greenfoot.isKeyDown("r")) { Greenfoot.setWorld(new Worldbackground()); } }
Player_Test1 player_test1 = new Player_Test1(movement_test21); addObject(player_test1,100,100);
Movement_Test2 movement_test21 = new Movement_Test2(); addObject (movement_test21, 100, 100); int movement_test21X = movement_test21.getX();