so this is my 1st time to try greenfoot
how can i add boss when i score like 500
this is my counter class
and this is my world class
public class Counter extends Actor
{
public int totalCount = 0;
public Counter()
{
setImage(new GreenfootImage("SCORE :", 20, Color.WHITE, Color.BLACK));
}
/**
* Increase the total amount displayed on the counter, by a given amount.
*/
public void bumpCount(int amount)
{
totalCount += amount;
setImage(new GreenfootImage("SCORE : " + totalCount, 20, Color.WHITE, Color.BLACK));
}public class ScrollingWorld extends World
{
public Player thePlayer;
public Erm theErm;
public Counter theCounter;
private HP theHP;
public ScrollingWorld()
{
super(800, 600, 1, false); //The extra 'false' parameter means that the world is unbounded.
thePlayer = new Player();
addObject(thePlayer, 300, 354); //Creates the player.
theErm = new Erm();
addObject(theErm, 0, -10);
theCounter = new Counter();
addObject(theCounter, 40, 340);
theHP = new HP();
addObject(theHP, 40, 200);
}
public void act()
{
String key = Greenfoot.getKey();
if (Greenfoot.isKeyDown("space"))
{
thePlayer.shoot();
}
if (Greenfoot.isKeyDown("left"))
{
thePlayer.moveLeft();
}
if (Greenfoot.isKeyDown("right"))
{
thePlayer.moveRight();
}
if (Greenfoot.isKeyDown("up"))
{
thePlayer.moveUp();
}
else if (Greenfoot.isKeyDown("down"))
{
thePlayer.moveDown();
}
}
public Player getPlayer()
{
return thePlayer;
}
public Erm getErm()
{
return theErm;
}
public Counter getCounter()
{
return theCounter;
}
public HP getHP()
{
return theHP;
}
/**
* Prepare the world for the start of the pPlayergram. That is: create the initial
* objects and add them to the world.
*/
private void prepare()
{
addObject(new Enemy(), getWidth() + 20 , Greenfoot.getRandomNumber(400));
addObject(new Enemy(), getWidth() + 20 , Greenfoot.getRandomNumber(400));
addObject(new Enemy(), getWidth() + 20 , Greenfoot.getRandomNumber(400));
}
}
