Here is what i tried and i'm getting an error
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Heartless here.
*
* @author (your name)
* @version (a version number or a date)
*/
/**
* Act - do whatever the Heartless wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public class Heartless extends Actor
{
HeartlessBlast heartlessblast = new HeartlessBlast();
LastHeartless lastheartless = new LastHeartless();
private int shotDelay = 0;
private int JumpChance = 0;
private int vspeed = 0;
private int acceleration = 1;
boolean CanJump;
private Bar healthBar;
public void act()
{
fall();
healthBar.setLocation(getX(), getY());
randomjump();
fap();
shoot();
hit();
World world = getWorld();
Level level = new Level();
world.addObject(level, world.getWidth()/2,world.getHeight()/2);
}
public Heartless()
{
healthBar = new Bar("", "", 100, 100);
healthBar.setShowTextualUnits(false);
healthBar.setBarWidth(30);
healthBar.setBarHeight(3);
healthBar.setMaximumValue(70);
healthBar.setValue(70);
healthBar.setBreakValue(10);
}
public void fap()
{
getWorld().addObject(heartlessblast, getX(), getY());
}
public void shoot()
{
if(shotDelay >= 100)
{
getWorld().addObject(new HeartlessBlast(), getX(), getY());
shotDelay = 0;
}
shotDelay++;
}
public boolean isOnGround()
{
Clone Window = (Clone) getWorld();
if(getY() + (getImage().getHeight() / 2) >= (Window.getHeight() -1)) {
vspeed = 0; return true;
}
return false;
}
public void randomjump()
{
if( isOnGround() && Greenfoot.getRandomNumber(100) ==3)
{
jump();
}
}
public void jump()
{
vspeed = -10;
fall();
}
public void fall()
{
setLocation ( getX(), getY() + vspeed);
vspeed = vspeed + acceleration;
}
protected void addedToWorld(World world)
{
world.addObject(healthBar, getX()-0, getY()-0);
Level level = new Level();
world.addObject(level, 500, 40);
}
public void hit()
{
Actor kiblast = getOneIntersectingObject(KiBlast.class);
if(kiblast != null)
{
healthBar.subtract(10);
getWorld().removeObject(kiblast);
}
if(healthBar.getValue() == 0)
{
World world = getWorld();
Clone clone = (Clone)world;
ScoringPoints scoringpoints = clone.getScoringPoints();
scoringpoints.addScore();
getWorld().addObject(lastheartless, getX(), getY());
getWorld().removeObject(healthBar);
getWorld().removeObject(this);
}
}
}

