i have java.lang.NullPointerException problem with my code help me i am trouble i am ernie in trouble
dan post help me im erniepublic class BossBattle extends World
{
Counter counter;
Score score;
// Gets music to play
//GreenfootSound backgroundMusic = new GreenfootSound("untitled.mp3");
/**
* Constructor for objects of class CopyOfPlayArea.
*
*/
public BossBattle()
{
// Create a new world with 800x800 cells with a cell size of 1x1 pixels.
super(600, 600, 1);
// Plays music
//backgroundMusic.playLoop();
prepare();
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
private void prepare()
{
Champion champion = new Champion();
addObject(champion,108,534);
Counter counter = new Counter();
addObject(counter,303,20);
counter.setLocation(292,13);
BossMan bossman = new BossMan();
addObject(bossman,471,148);
}
public void removeHealth2()//this is used to remove health
{
counter.add(-2);
}
public void addHealth()
{
counter.add(20);
}
public int getHealth()//this allows classes get
{
int x = counter.gethealth();
return x;
}
}public class People extends Movers
{
public int health = 100 + Greenfoot.getRandomNumber(50);
public void deadChampion()
{
if (this.getWorld().getClass() == PlayArea.class)
{
PlayArea world1 = getWorldOfType(PlayArea.class);
if(world1.getHealth()<=0)
{
getWorld().removeObject(this);
Greenfoot.setWorld(new GameOver());
}
}
}
public void deadChampion2()
{
if (this.getWorld().getClass() == BossBattle.class)
{
BossBattle world2 = getWorldOfType(BossBattle.class);
if(world2.getHealth()<=0)
{
getWorld().removeObject(this);
Greenfoot.setWorld(new GameOver());
}
}
}
public void removeHealth()
{
if (this.getWorld().getClass() == PlayArea.class)
{
if(canSee(Monsters.class))
{
PlayArea world = getWorldOfType(PlayArea.class);
world.removeHealth();//removes players health
}
}
}
public void removeHealth2()
{
if (this.getWorld().getClass() == BossBattle.class)
{
if(canSee(BossMan.class))
{
BossBattle world = getWorldOfType(BossBattle.class);
world.removeHealth2();//removes players health
}
}
}
}
public class Champion extends People
{
public int health = 100;
int x;
int y;
int firecount;
public void act()
{
checkKeys();
firecount++;
if(firecount > 5)
if(Greenfoot.isKeyDown("space"))
{
getWorld().addObject(new Bullet(getRotation()), getX(), getY());
firecount = 4;
}
removeHealth();
removeHealth2();
addHealth();
deadChampion();
deadChampion2();
}
/**
* Check whether the control keys are being pressed, and turn
* if they are.
*/
public void checkKeys()
{
//these events make this program an event driven application.
if ( Greenfoot.isKeyDown("up") )//trigger function
{
move(8);//event handler
}
if ( Greenfoot.isKeyDown("down") )//trigger function
{
move(-5);//event handler
}
if ( Greenfoot.isKeyDown("left") )//trigger function
{
turn(-5);//event handler
}
if ( Greenfoot.isKeyDown("right") )//trigger function
{
turn(5);//event handler
}
}
public void addHealth()
{
if(canSee(HealthPack.class))
{
PlayArea world = getWorldOfType(PlayArea.class);
world.addHealth(); //adds health to the player
//adds a new health pack randomly in the game area
getWorld().addObject(new HealthPack(), Greenfoot.getRandomNumber(getWorld().getWidth()), Greenfoot.getRandomNumber(getWorld().getHeight()));
}
}
}

