public class beeInput extends Actor
{
//create variable
int beeValue;
boolean error;
/**
* Act - do whatever the beeInput wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
//Create input box, ask for value, set bounds for beeValue
setImage(new GreenfootImage("Input.png"));
//set value of bees based off the input
if(Greenfoot.mouseClicked(this)){
beeValue = Integer.parseInt(Greenfoot.ask("Please input a value for the amount of bees"));
if(beeValue < 3 || beeValue > 25)
{
World world = getWorld();
world.addObject(new errorMessagebees(), 400, 400);
}
else world.removeObjects(world.getObjects(errorMessagebees.class));
}
}
}
