Game Development Community

Fade Out/In A Scene

by Dave DAmico · in Torque X 2D · 07/10/2008 (10:28 am) · 4 replies

Is there a way to fade out a scene?

What I want to do is:

1. Have the user get to a certain point in a scene
2. Call a fade function
3. After the fade is complete unload the current scene
4. When the scene is unloaded load a new scene
5. When the new scene is loaded I want to fade back in

Any suggestions?

Thanks,
Dave

#1
07/10/2008 (6:33 pm)
One possibility is to use GUISplash. Set the bitmap to a black bitmap (or whatever you want). Set the fadein and fadeout parameters. Then at the point you want the scene to fade, use GUICanvas.SetContentControl(mySplash). You will also need to set the OnFadeFinished delegate to a method where you unload and load the next scene and similarly use a GUISplash to fade in ...

Typically GUISplash fades in, holds, then fades out ... not sure if you can set it to only fade in or fade out. If not, you can either subclass it or you could use a GUIBitmap and do your own fading which just means change the texture's opacity from 0 to 1 over time.
#2
07/10/2008 (6:42 pm)
Loop through the scenegraph's objects, and change their BlendAlpha value over time until it reaches 0, then unload. Scott's method is much quicker, but this is an alternate way using the objects themselves.

Or place a black bitmap over the scene, set to alpha 0, then increase to 1 over time.
#3
07/10/2008 (8:34 pm)
These are both great suggestions. If you have the pro license, you can also rip the fade out code from the splashscreen gui, something like OnRender() and UpdateAnimation() and paste them right into a new GuiSceneview-derrived class.

John K.
#4
07/11/2008 (6:35 am)
Excellent information I will give this a try. Thanks for the help!