At line 44 in your ScrollWereld class (in the 'scroll' method), you are trying to execute a method of a field or object reference that returns 'null' (either the field is not set to any object or a method call is return a null object).
public void scroll() { int scrolledAmt = scroll.changeScrollX(/* scroll speed */); for (Object obj : getObjects(null)) { Actor actor = (Actor)obj; // if (actor instanceof Buggy.class && actor instanceof Wheel.class) actor.setLocation(actor.getX()-scrolledAmt, actor.getY()); } }
// instance fields Scroll[] scrollWorlds = new Scroll[9]; int scrollWorld; // in your world constructor GreenfootImage bgScroll = new GreenfootImage("image.png"); for (int n=0; n<9; n++) { GreenfootImage image = new GreenfootImage(2000, 600); image.drawImage(bgScroll, -n*1000, 0); scrollWorlds[n] = new Scroll(image, this); }