so I’m trying to simply fade out my scene when the character goes beyond the map limits. Problem is, it fades to black then goes back to the scene for a second before resetting the scene.
Here’s the code I’m using :
// `Fade` the Camera out with a 250 millisecond delay
cam.fade ( 250, 0, 0, 0, false, ( camera, progress ) => {
if ( progress > 0.999 ) {
this.__scene.restart();
}
} );
cam.on ( Phaser.Cameras.Scene2D.Events.FADE_OUT_COMPLETE, ( ) => {
this.__playerFallsInHole = false;
} );