I have a menu icon if i press on it, it opens the building menu and i can choose wich building i want to build. If i click on the Building the building follows the cursor and i can place it.
The problem is my menu ist to big and i want that each time i have selected a building the interface closes i have a code but actually just the menu is deleting and the building don't get on my cursor but why? please Help!
public class Building1 extends Buildings { int mausX; int mausY; /** * */ public void act() { if(this !=null) { mausX = Greenfoot.getMouseInfo().getX(); mausY = Greenfoot.getMouseInfo().getY(); } if (Greenfoot.mouseClicked(this)) { getWorld().addObject(new CursorBuilding1(), mausX,mausY); getWorld().addObject(new Baumenu(),50, 650); getWorld().removeObjects(getWorld().getObjects(Inteface.class)); } } }