FadeIn/FadeOut sequencing

Started by Monsieur OUXX, Thu 14/12/2006 11:51:26

Previous topic - Next topic

Monsieur OUXX

EDIT : solution found

Quote
Hi,

I have to make a FadeOut/FadeIn at one particular moment in the game
(not while CHANGING room, but while the player IS in the room).
Between the fadeout and the fadein, I make some objects disappear.

I've tried the code below, but it doesn't work, because of the order of execution of the instructions (virtually all executed at the same time, am i wrong?) : the fadeout/fadein first happens, and THEN the objects disappear !
Code: ags

FadeOut(10);
object[2].visible = false;
FadeIn(10);


Anyway, I've seen in this thread ( http://www.adventuregamestudio.co.uk/yabb/index.php?topic=26527.0 ) that this code, based on the same principle, should work :
Code: ags

FadeOut (10);
SetBackgroundFrame(0);
FadeIn (10);


So how does it come?

I've read that most of the times, the Fade problems are solved by placing the appropriate code in the "player enters room" events, because it explicitely happens BEFORE or AFTER the fade.
But while the player IS in the room, there is no such event handling.

I've thought of using a special "black" room, where I could send the player when it's all black, and then send him back to the original room and take advantage of the "before fade in" event, but it's dirty dirty dirty...

Any idea?


All the actions have to be placed in the same script (for example, don't put "FadeOout" in a "Run Script" action, then "Remove objects" actions, then another "run script" action containing "FadeIn".

And, most important, within the script, you have to put a "Wait" after any critical action. In this case this would be AFTER objects disappear and BEFOR FadeIn.

Here is the final code :
Code: ags

FadeOut(15);


object[2].Visible = true;
object[3].Visible = true;

Wait(10);
FadeIn(15);  


I'm not sure but I think that "Wait" forces the game to let a few ticks pass, and is "blocking", so instructions placed after will be logically executed at another tick than the previous ones (actions executed during the same tick are executed in a random order, aren't they?).
Consequently, they will be executed after the previous ones in time.
 

SSH

No, its that Wait forces a screen update, but the fade commands use an odd mechanism and don't force an update.
12

SMF spam blocked by CleanTalk