@dordor, it's no problem. Thanks for your reply and patience. I really appreciate that!
public class Bullet extends Actor { public int zombieCounter =0; public void act() { setLocation(getX(),getY()-10); boolean removed = checkEdge(getY()); if (!removed) { boolean killed = checkKill(); if(killed) zombieCounter++; } } public boolean checkKill() { boolean killed = false; Actor zombie; zombie = getOneObjectAtOffset(0,0,Zombie.class); if(zombie!=null) { World world; world = getWorld(); world.removeObject(zombie); int sound = Greenfoot.getRandomNumber(2); if(sound==0) Greenfoot.playSound("zombieDeath.wav"); else Greenfoot.playSound("zombieDeath2.wav"); getWorld().removeObject(this); killed=true; } return killed; }
ZombieWorld zombieWorld=new ZombieWorld(); public void act() { setLocation(getX(),getY()-10); boolean removed = checkEdge(getY()); if (!removed) { boolean killed = checkKill(); if(killed) zombieWorld.addKilledAmount(); } }
boolean nextLevel = nextLevel(); if(nextLevel){ zombie.addZombieLevel(); gameLevel++; setBackground("bathroom-tile.jpg"); } }
public boolean nextLevel(){ boolean nextLevel = false; if (zombieCounter>10){ nextLevel=true; }else nextLevel=false; return nextLevel; }
public void addKilledAmount(){ zombieCounter++; }
new ZombieWorld()
(ZombieWorld)getWorld()
public boolean nextLevel() { return (zombiesCounter > 10); }
if (zombieCounter > 10) {