How to make Fade in and fade out screen ?
Posted:
Tue Aug 10, 2010 6:41 am
by Wertyboy
Hi all, how to make fade in and fade out screen when game startup
Re: How to make Fade in and fade out screen ?
Posted:
Tue Aug 10, 2010 1:07 pm
by Game A Gogo
create a variable called "Fader" (might be a good idea if it's local)
in the draw actor of your logo or whatever object you want to fade:
- Code: Select all
if(Fader==0)transp-=0.2;
else if(Fader==1)transp+=0.2;
if(transp<=0)Fader=1;
else if(transp>=1 && Fader==1)
{
//if this is a logo
DestroyActor("Event Actor");
//or if you want it to keep flashing
Fader=0;
}
make sure to delete either the DestroyActor or Fader=0; for what you want to use
And this in the create actor:
- Code: Select all
transp=1;
Re: How to make Fade in and fade out screen ?
Posted:
Tue Aug 10, 2010 2:55 pm
by Wertyboy
thx
but the logo is fade out too fast, i want to : after 5 seconds, logo fade out
Re: How to make Fade in and fade out screen ?
Posted:
Tue Aug 10, 2010 5:03 pm
by Game A Gogo
change the 0.2 value of the first two line, maybe 0.025 ?
Re: How to make Fade in and fade out screen ?
Posted:
Tue Aug 10, 2010 6:03 pm
by Hblade
make a timer variable. Then place Gag's code where it says GC
- Code: Select all
timer++;
if (timer>=real_fps*5) // 5 is the ammount of seconds to wait)
{
GC
timer = 0;
}
Like I said, replace GC with gag's code. Game A Gogo's code :3
Re: How to make Fade in and fade out screen ?
Posted:
Tue Aug 10, 2010 7:13 pm
by Game A Gogo
hblade that makes it like 5923750912653092683054293 time more complicated than it should be....
Re: How to make Fade in and fade out screen ?
Posted:
Wed Aug 25, 2010 2:10 pm
by DBGames
can you even say that number?
Re: How to make Fade in and fade out screen ?
Posted:
Wed Sep 01, 2010 3:28 am
by Wertyboy
Uhm..... need help with this logo
I want to the BlackScreen Actor Change Tranparent : 100; after that, change tranparent :0
Re: How to make Fade in and fade out screen ?
Posted:
Wed Sep 01, 2010 3:39 am
by DST
okay, 2 things:
Transparency is a float, its min value is 0 and it's max value is 1. So it will never be greater than 2.
So you say, transp +=whatever, and then, if you want to disable it, do this:
if (transp>0.99){
VisibilityState("Event Actor", DISABLE);}
now that disables all drawing (and also collision/mousedown) for this actor. But consider this too...create an actor, real, variable. That will be a float (decimal).
So then try:
transp+=myfade;
if(transp>0.99){
VisibilityState("Event Actor", DISABLE);}
and just set myfade to 0.2 on startup.
Now, at any time, like when you get ready to end the level, or the player leaves the game, and you want black to come BACK, try
VisibilityState("black", ENABLE); //will still be invisible cause transp is still at 1
black.myfade=-0.2; //will start fading back in
now, transp+=myfade....1+-.02 =.98....suddenly, you see, you can make black fade in and out at any time, by simply changing the value of the real actor variable 'myfade'. When black is visible, it stays visible until you give myfade a positive value. You can call black.myfade from any actor or script....from player click on button to boss death to score tallied up to player exits game. From any event, you can just call black.myfade and give it a value.
If black becomes transparent, it will always use 'visibility state' to turn itself off. You just have to remember to turn it on again when you want it back.
Re: How to make Fade in and fade out screen ?
Posted:
Mon Dec 27, 2010 11:31 am
by Wertyboy
Back! So who have fade out code without any variable?
Re: How to make Fade in and fade out screen ?
Posted:
Mon Dec 27, 2010 11:45 am
by needaname
you need to at least deal with transp. transp is the transparency variable, like dst said above. this code will cause your actor to fade out (draw event). it'd be better to use somethin like dst did though.
- Code: Select all
transp+=0.02;