Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Chosim on Wed 01/06/2011 21:19:04

Title: Fade in and out Effect in a special Area
Post by: Chosim on Wed 01/06/2011 21:19:04
So, I'm sorry for the following violate of the english language.

Okay my first question is, must I make a Game in english?

The second question is for the programmer under you. ^^

I want the Fade-in-and-out Effect only in a special Area. But How?

(http://img24.imageshack.us/img24/7820/unbenanntofy.png)
Title: Re: Fade in and out Effect in a special Area
Post by: mode7 on Thu 02/06/2011 00:18:37
Ok here's what to do

1. Get the tween module, install it
2. Create a new gui make it a bit smaller than your games resolution and position it on the appropriate area on the screen
3. Make the guis Background color black, set the gui to invisible and give it a name like "gFade"
4. To fade in call

gFade.Transparency = 100;
gFade.Visible = true;
gFade.TweenTransparency (0.5, 0,...other stuff which is explained in the popup description

Title: Re: Fade in and out Effect in a special Area
Post by: Creator on Thu 02/06/2011 03:04:00
Quote from: Chosim on Wed 01/06/2011 21:19:04
Okay my first question is, must I make a Game in english?

No. You can make a game in any language you want, but you can also make translations for your game.  ;)
The "only English" rule applies to the forums only.
Title: Re: Fade in and out Effect in a special Area
Post by: Lt. Smash on Thu 02/06/2011 18:34:40
@mode7: The TweenTransparency function would only work if he has downloaded the TweenModule.

If you don't want to do that you can make your own simple FadeIn/Out function:


//Put this in GlobalScript:
void Fade (this GUI*, bool fadeIn)
{
  int t = this.Transparency;
 
  if (fadeIn) {
    while (t >= 0) {
      this.Transparency = t;
      t--;
      Wait(1);
    }
    this.Clickable = true;
  }
  else {
    while (t <= 100) {
      this.Transparency = t;
      t++;
      Wait(1);
    }
    this.Clickable = false;
  }
}
// Put this in GlobalHeader:
import void Fade (this GUI*, bool fadeIn=true);

// And then everytime you want to fade your GUI call:
gGuiName.Fade(true); //FadeIn
gGuiName.Fade(false); //FadeOut