How to fade out, draw image, fade in, draw normal backgroud?

Started by bx83, Tue 28/11/2017 01:28:36

Previous topic - Next topic

bx83

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: ags

cGiraffe.Say("&21 YES, HE'S A HU--");

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

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

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

//thing's continue like a chunk of time was taken out by title card:
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!");


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

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

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

eri0o

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

Fantastic, replaced with GUI, no fading in/out, all works :)
Thankyou :)

SMF spam blocked by CleanTalk