Author Topic: How to fade out, draw image, fade in, draw normal backgroud?  (Read 395 times)


  • Posts: 260
  • Get 'Er Doooooone
Hi, I've been having trouble inserting an image, then going back to the main game. The insert is like a title card; appears for a second while some audio plays, everything else is fade out, goes back to normal background, everything is faded in and restored.

Code: [Select]
cGiraffe.Say("&21 YES, HE’S A HU--");

//the title card:
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawImage(1, 1, 135);

//audio to go with title card
cDummy.Say("&1 Six hours later...");

//everything's restored:
DrawingSurface *surface2 = Room.GetDrawingSurfaceForBackground();
surface2.DrawImage(0, 0, 2280);

//thing's continue like a chunk of time was taken out by title card:

The problem is;
If I use FadeOut/FadeIn, it goes to absolute black, and the characters cannot be seen (good), but neithey can the title card (bad);
If I just do it as above, and just draw the title card, all the characters and objects apear (bad).


Can I do this any other way than: setting everything to invisible, draw title card, say speech, draw back background, make all visible again?

Also while we're at it; how would I make the background and object's fade out, but *not* the character? Similar to a scene in which Guybrush dies in the Something of Monkey Island? (background fades out; then guybrush falls; then he fades out; then everything fades in again at a different location).


  • Posts: 10,651
  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on a game that was nominated for an AGS Award!
I'd use a GUI and fade its Transparency. You could use the Tween module for that.
As for the character remaining visible, I'd put the sprite on a separate GUI further up.

One can of course do all this with just the room background's drawing surface, but using GUIs is a lot simpler.


  • Posts: 351
  • The dinosaur guy
    • I can help with AGS tutoring
    • I can help with animation
    • I can help with characters
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • CrashPL worked on a game that was nominated for an AGS Award!
I'd go around this by creating a GUI, with a size of your game's resolution and simply displaying it - the GUIs are drawn on a separate 'layer', so everything on the scene will always be covered by them.
However large GUIs can be a bit taxing on your resources, if you're aiming to run the game on lower-end PCs. Alternatively you can create a new dummy, unclickable and hidden by default object in the target room, assign the overlay graphic to it, set it to (0,0) coords, make it visible, play the sound and then hide it.

//edit: ah, Khris beat me to it. ;)


  • Posts: 397
    • eri0o worked on a game that was nominated for an AGS Award!
To fade everything except the player character you could create a character that is a big black box, and set the player baseline to screen height and the black border character baseline to the same baseline minus 1 and use the tween module on transparency to fade.


  • Posts: 260
  • Get 'Er Doooooone
Fantastic, replaced with GUI, no fading in/out, all works :)
Thankyou :)