You can try putting code into the started() function for the world class instead of the constructor and use a boolean variable to prevent it from loading again on pause/resume. Like so:
This fixed a bug I found in my own code earlier where the game would not load when I called Greenfoot.setSpeed() in the constructor, but this method let's me do basically the same thing.
1 2 3 4 5 6 7 8 9 10 11 12 | boolean initialize; //will be false by default public yourWorld(){ super ( 640 , 400 , 1 , false ); } public void started(){ if (initialize == false ){ loadStartupCode(); initialize = true ; } } |