I'm working through the asteroids scenario in the book and have implemented a sound effect at the end of each level, when all the asteroids are cleared, but it keeps being played over by the sound effect from the asteroid being destroyed. I tried implementing the delay function with the following code:
but that just seems to pause the whole scenario and the sound is still covered up. Is there a way to delay say the space method while the asteroid method finishes? The delay just seems to pause the whole scenario.
Thanks.
if (totalNeededForOneDestroyed==asteroidsKilled) { currentLevel++; levelCounter.updateLevel(currentLevel); levelCounter.act(); //addObject(new Scoreboard.makeImage("Next Level", "Level: ", currentLevel)); Greenfoot.delay(20); Greenfoot.playSound("level.wav");