Fade in and out Effect in a special Area

Started by Chosim, Wed 01/06/2011 21:19:04

Previous topic - Next topic

Chosim

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?

--------------------------------------------------------------------------------------------------
|                             Internet Spaceships is Serious Business                                    |
--------------------------------------------------------------------------------------------------

mode7

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

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


Creator

#2
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.

Lt. Smash

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

Code: ags

//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

SMF spam blocked by CleanTalk