Use 'if' (to limit), 'Greenfoot.getRandomNumber' (to randomize) and 'addObect' (to add the enemies) in your World subclass act method. If you have issues with coding, post what you have tried and we can help correct it.
i've only been able to get it to start at a set location, idk how to do the rest
private void prepare()
{
Enemy enemy = new Enemy();
addObject(enemy, 178, 788);
}
actually i have it how i wanted it
{
getWorld().removeObject(Evil);
Enemy enemy = new Enemy();
getWorld().addObject(enemy, Greenfoot.getRandomNumber(950), Greenfoot.getRandomNumber(900));
}
Now is it possible to make this coincide with an onscreen counter. So that everytime the enemy is removed it goes up by 10
i've only been able to get it to start at a set location, idk how to do the rest
private void prepare()
{
Enemy enemy = new Enemy();
addObject(enemy, 178, 788);
}
You can replace the hard-coded int values, '178' and '788' with method calls that return or variables that hold random int values.
EDIT: just saw your second post -- looks okay. And yes, it is possible to have the counter add 10 to its value. Show your Counter class code, the code that creates and add one into the world and your attempt at accessing/changing its value.