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

bx83

  • 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: Adventure Game Studio
  1. cGiraffe.Say("&21 YES, HE’S A HU--");
  2.  
  3. //the title card:      
  4. DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
  5. surface.DrawImage(1, 1, 135);
  6. surface.Release();             
  7.  
  8. //audio to go with title card  
  9. cDummy.Say("&1 Six hours later...");
  10.  
  11. //everything's restored:
  12. DrawingSurface *surface2 = Room.GetDrawingSurfaceForBackground();
  13. surface2.DrawImage(0, 0, 2280);
  14. surface2.Release();
  15.  
  16. //thing's continue like a chunk of time was taken out by title card:
  17. cGiraffe.Say("&22 ANYWAY SO I SAY’S TO HIM, MAYBE IF YOU DIDN’T DROP THE BOOK *QUITE* SO OFTEN, IT WOULDN’T SMELL FISHY!");
  18.  

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).

Video:
http://redrom.ltd/img/6hours.webm

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).


Khris

    • 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.

CrashPL

  • 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. ;)

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.

bx83

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