I'm trying to make that if my first enemy is killed then a new one will show up i find it hard to make a new level so i decided to make it continuous and here's my code although i'm getting a syntax 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(); 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(); } 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); } 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.class); getWorld().removeObject(healthBar); getWorld().removeObject(this); } } }