Hi, okay so i have a button and a minim, What i want to do is when the button is clicked (either by a button on the keyboard or by the mouse) the minim appears on the screen. Now i have managed to get it so that when a certain key is pressed on the keyboard the button is activated and the minim appears but i am having trouble working out the syntax for when the button is clicked by the mouse.
My code in the world class :-
public class Background extends World
{
private boolean clicked;
    public Background()
        {    
         super(600, 400, 1); 
        addObject( new Button(), 300, 200);
        }
    
    public void act()
        {   
        String key = Greenfoot.getKey();
        if("g".equals(key)) addObject(new Minim(), 200, 100);
        }
    
    public boolean gotClicked()  
    {  if(Greenfoot.mouseClicked(this)) clicked=true;
        boolean wasClicked=clicked;  
        clicked=false;  
        return wasClicked;  
    }
}
  
  
            
          
        