Fade between scenes
jota

Hi

 

How can i implement fades between scenes? a fadeout on the scene that is cleared and a fade in on the loaded scene.

 

 

I'm trying to implement the fade.js as in the exemple of spot the diference game, but can't figure how

 

All 3 Comments
Gio

Hi

 

If I remember correctly, fade.js was intended to be a Behavior that you assign to your objects to make them fade in and out.

 

You could do that, but then you'd have to apply it to all of the objects in both scenes. I wouldn't recommend it, as there are easier ways.

 

Which one of the following is easier really depends on your project.

 

Solution A (probably easier, but only if you can use different layers):

 

Use different layers for Scene 1 and Scene 2. When it's time to switch scenes, use wade.fadeInLayer() and wade.fadeOutLayer()

 

Solution B:

 

Use wade.screenCapture() to draw everything that is on the screen to a Sprite. Clear the scene, then add this new Sprite to the scene. When the new scene is loaded, fade out your sprite using fade.js. Potentially you can do the same with the second scene: draw everything to a sprite, set everything to invisible, fade in the sprite, set everything to visible again, remove the sprite.

 

 

Also, if I remember correctly there was a bug in fade.js if you were trying to use it multiple times. I'll see if I can find some time to look into it today.

jota

hi

 

Thank you for your reply, i'm gonna test the two methods, though, i'm a little reluctant in using fade.js if there' a bug in it :(

Ibiva

this script he means work, but it is comming back, how do i stop that?

Post a reply
Add Attachment
Submit Reply
Login to Reply