This site requires JavaScript, please enable it in your browser!
Greenfoot back
xixEmilyxix
xixEmilyxix wrote ...

2021/12/9

When actor clicked a counter increases by one

1
2
3
danpost danpost

2021/12/24

#
The act method in MainMenu needs:
if (Greenfoot.mouseClicked(btnHelp))
{
    ...
}
in it with implementation for the help button to work.
xixEmilyxix xixEmilyxix

2021/12/24

#
danpost wrote...
The act method in MainMenu needs:
if (Greenfoot.mouseClicked(btnHelp))
{
    ...
}
in it with implementation for the help button to work.
Ive made these changes and when i click the any of the buttons, nothing happens - any ideas how to fix this part ? Thanks :D
danpost danpost

2021/12/24

#
xixEmilyxix wrote...
Ive made these changes and when i click the any of the buttons, nothing happens - any ideas how to fix this part ? Thanks :D
Please provide revised class codes (MainMenu, BeeWorld and any other addition/changes).
xixEmilyxix xixEmilyxix

2021/12/24

#
danpost wrote...
xixEmilyxix wrote...
Ive made these changes and when i click the any of the buttons, nothing happens - any ideas how to fix this part ? Thanks :D
Please provide revised class codes (MainMenu, BeeWorld and any other addition/changes).
    public void act()
    {
        if(Greenfoot.mouseClicked(btnStartButton))
        {
           //start simulation when start button is clicked
           startSimulation();
        }
        if (Greenfoot.mouseClicked(btnHelp))
        {
            //show help menu when help button is clicked
            help();    
        }
    }
    
    private void startSimulation()
    {
        Greenfoot.setWorld(new BeeWorld(weatherInput.weatherValue)); 
    }
    
    private void help()
    {
        //add help menu
        HelpMenu HelpMenu = new HelpMenu();
        addObject (HelpMenu, getWidth(), getHeight());
        HelpMenu.setLocation(650,200);
        
        //button to be able to remove help menu
        RemoveMenu RemoveMenu = new RemoveMenu();
        addObject (RemoveMenu, getWidth(), getHeight());
        RemoveMenu.setLocation(900,200);
    }
}
danpost danpost

2021/12/24

#
xixEmilyxix wrote...
Ive made these changes and when i click the any of the buttons, nothing happens
Maybe the clicks are happening on some other actor(s) that is over top of the buttons?
xixEmilyxix xixEmilyxix

2021/12/24

#
danpost wrote...
xixEmilyxix wrote...
Ive made these changes and when i click the any of the buttons, nothing happens
Maybe the clicks are happening on some other actor(s) that is over top of the buttons?
Theres no actors above the buttons at all, the only other actors in the world are the bees, the hive and the flowers
danpost danpost

2021/12/24

#
xixEmilyxix wrote...
Theres no actors above the buttons at all, the only other actors in the world are the bees, the hive and the flowers
Try adding the following line into your BeeWorld constructor:
setPaintOrder(Buttons.class);
You need to login to post a reply.
1
2
3