martijn13039, you wrote that line of code yourself. So: tell us what it is meant to do...
World2 mw = (World2) getWorld(); mw.setMenuItem(caption);
setMenuItem(caption)
import greenfoot.*; public class Menu extends Actor { private String menuItem = ""; private boolean menuDone = false; public void act() { if (!menuDone && !"".equals(menuItem)) { removeObjects(getObjects(Menu.class)); // set up background for game // add objects for game menuDone = true; } // rest of act (for game play) } public void setMenuItem(String muItem) { menuItem = muItem; } }
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class World2 extends World { public boolean Start; /** * Constructor for objects of class loll. * */ public World2() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(600, 400, 1); } private String menuItem = ""; private boolean menuDone = false; public void act() { if (!menuDone && !"".equals(menuItem)) { removeObjects(getObjects(Menu.class)); menuDone = true; } } public void setMenuItem(String muItem) { menuItem = muItem; } }