Im back again....
my new goal is to use a timer to spawn an Exit at a certain amount of time and also cut off the enemy spawns. I haven't messed with cutting off the spawns yet but suggestions are appreciated. Any way my current problem is the LevelDone() method wont grab the time like i want it to and spawn the Ladder()
public class Forest extends World { ForestFloor forestFloor; SirB sirB; Porcubutt porcubutt; BlackKnight blackKnight; public int pausePorky = 50; public int pauseBK = 185; private int screenSide = 0; private boolean running = false; private int millisElapsed = 0; private long lastTime = 0; private boolean levelDone =false; private int kills = 0; public Forest() { super(750, 360, 1); forestFloor = new ForestFloor(); addObject ( forestFloor, 375, 347); sirB = new SirB(); addObject ( sirB, 76, 272); } public void act() { spawnPorcubutts(); spawnBlackKnights(); Time(); Objects(); } public void Objects() { if (getObjects(Exits.class).isEmpty()) { LevelDone(); } } public void LevelDone() { if (millisElapsed == 30000) { addObject ( new Ladder(), 413, 182); } } public void start() { millisElapsed = 0; lastTime = 0; } public void Time() { long time = System.currentTimeMillis(); if(lastTime !=0) { long diff = time - lastTime; millisElapsed += diff; } lastTime = time; } public void spawnPorcubutts() { porcubutt = new Porcubutt(); if (pausePorky > 0 ) { pausePorky --; return; } if (pausePorky == 0 && levelDone == false) { int x = getScreenSide(); addObject (new Porcubutt(), x , 314); pausePorky = 50; } } public void spawnBlackKnights() { blackKnight = new BlackKnight(); if (pauseBK > 0) { pauseBK --; return; } if (pauseBK == 0 && levelDone == false) { int x = getScreenSideBK(); addObject (new BlackKnight(), x , 286); pauseBK = 50; } } public int getScreenSide() { screenSide = Greenfoot.getRandomNumber(4); if (screenSide >=2) { return 684; } if (screenSide <= 2) { return 75; } return 684; } public int getScreenSideBK() { screenSide = Greenfoot.getRandomNumber(4); if (screenSide >=2) { return 79; } if (screenSide <= 2) { return 645; } return 684; } }