Closed arakash92 closed 11 years ago
The issue is likely that the atmosphere overlay is not yet added to the world when you remove it, so it never gets added at all. Remember that when you use ig.game.spawnEntity
it creates the entity immediately, then puts the entity in a deferred list, and on the next update actually adds the entity to the game. Try this:
camera.addAtmosphere(0);
// check if atmosphere overlay is actually added to the game
if ( camera.atmosphereOverlay.added ) {
camera.removeAtmosphere(2);
}
// otherwise, wait for the added signal and then remove
else {
camera.atmosphereOverlay.onAdded.addOnce( function () {
camera.removeAtmosphere(2);
} );
}
Ah, right. thanks!
So I'm trying to have my world/level fade in and out.
I have the following code:
Doesn't seem to work :s