Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: stuh505 on Sun 23/05/2004 02:20:08

Title: room transitions - transition speed?
Post by: stuh505 on Sun 23/05/2004 02:20:08
I like the fade transition, but it is unbearably slow for me.  Is there any way to adjust the speeds of these transitions?
Title: Re: room transitions - transition speed?
Post by: Eddie Chewbacca on Sun 23/05/2004 09:32:51
The below code is how to change the speed of the FadeOut function.Ã,  Same goes for FadeIn functions.

FadeOut (int speed)

Fades the screen out to black. SPEED is the speed of the fade, from 1 (slowest) to 64 (instant). You can restore the screen with FadeIn.

Example: FadeOut(30);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  FadeIn(10);

Only thing I'm not sure of myself, being relatively new to AGS, is if you only need to set this variable once, or if it needs to be done in each room.Ã,  I'd assume you would only need to set it once, so maybe try adding the code in the global script under "game_start", or inÃ,  first room the charcater begins in, under "First Time Player Enters Screen" possibly.Ã,  You can of course change this for each room if you want to.Ã,  If this does not help, then I'll have to leave it to the experts to help you out.Ã, 

Good luck.
Title: Re: room transitions - transition speed?
Post by: Pet Terry on Sun 23/05/2004 09:40:27
The bigger the resolution of the game, the slower the transition.

EDIT: Also, I think, if the game file size is really big, it slows down the transition.
Title: Re: room transitions - transition speed?
Post by: stuh505 on Sun 23/05/2004 18:26:30
huh? 

I already knew about these functions, but I did not use them because the help file does not say it does that.  the help file says:

QuoteFades the screen out to black. SPEED is the speed of the fade, from 1 (slowest) to 64 (instant). You can restore the screen with FadeIn.
NOTE: This is a blocking function.

Anyway, I just did a small test to see if they ALSO change the default room transition speeds...and they do not.  So, my question stands...
Title: Re: room transitions - transition speed?
Post by: Scorpiorus on Sun 23/05/2004 18:50:46
Currently, it's not possible to change the fade-in/out transition speed, so yes, you have to workaround it with FadeIn/FadeOut functions.
Title: Re: room transitions - transition speed?
Post by: stuh505 on Sun 23/05/2004 20:06:07
Ah, so in other words,

//header
int FADE_SPEED = xx;

//global
function on_event(LEAVE_ROOM,DATA){
  //PRE: transition type == instant
  FadeOut(FADE_SPEED);
}

function on_event(ENTER_ROOM,DATA){
  //PRE: transition type == instant
  FadeIn(FADE_SPEED);
}
Title: Re: room transitions - transition speed?
Post by: Scorpiorus on Sun 23/05/2004 20:37:03
Yeah, the only trouble is that the ENTER_ROOM event occurs before the room screen is drawn, therefore you won't see the fade-in transition.

A workaround is to set a flag and check it on the first call of the repeatedly_execute_always:

// main global script

int fade_speed = 1;

int flag = 0;
function on_event(int event, int data) {

   if (event==ENTER_ROOM) {
      flag = 1; // set flag instead of calling FadeIn()
   }
   else if (event==LEAVE_ROOM) {
      FadeOut(fade_speed);
   }

}

function repeatedly_execute_always() {

   if (flag) {
      FadeIn(fade_speed);
      flag = 0; // reset flag
   }

}
Title: Re: room transitions - transition speed?
Post by: stuh505 on Sun 23/05/2004 20:44:34
[chuckle]

ah, what a nuisance  :P

thanks, though.
Title: Re: room transitions - transition speed?
Post by: Scorpiorus on Sun 23/05/2004 21:05:39
One thing though, it's actually not allowed to run blocking functions from within the repeatedly_execute_always(). But both FadeIn() and FadeOut() work though. :P
So it's either a bug or a new unofficial feature. Hope the last..