How to make Fade in and fade out screen ?

Talk about making games.

How to make Fade in and fade out screen ?

Postby Wertyboy » Tue Aug 10, 2010 6:41 am

Hi all, how to make fade in and fade out screen when game startup :?: :!:
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: How to make Fade in and fade out screen ?

Postby Game A Gogo » Tue Aug 10, 2010 1:07 pm

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;
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: How to make Fade in and fade out screen ?

Postby Wertyboy » Tue Aug 10, 2010 2:55 pm

thx :D but the logo is fade out too fast, i want to : after 5 seconds, logo fade out
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: How to make Fade in and fade out screen ?

Postby Game A Gogo » Tue Aug 10, 2010 5:03 pm

change the 0.2 value of the first two line, maybe 0.025 ?
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: How to make Fade in and fade out screen ?

Postby Hblade » Tue Aug 10, 2010 6:03 pm

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
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: How to make Fade in and fade out screen ?

Postby Game A Gogo » Tue Aug 10, 2010 7:13 pm

hblade that makes it like 5923750912653092683054293 time more complicated than it should be....
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: How to make Fade in and fade out screen ?

Postby DBGames » Wed Aug 25, 2010 2:10 pm

can you even say that number?
User avatar
DBGames
 
Posts: 113
Joined: Wed Jun 24, 2009 10:13 am
Location: Bismarck, North Dakota
Score: 8 Give a positive score

Re: How to make Fade in and fade out screen ?

Postby Wertyboy » Wed Sep 01, 2010 3:28 am

Uhm..... need help with this logo
I want to the BlackScreen Actor Change Tranparent : 100; after that, change tranparent :0
Attachments
Logo.rar
(11.19 KiB) Downloaded 71 times
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: How to make Fade in and fade out screen ?

Postby DST » Wed Sep 01, 2010 3:39 am

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.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: How to make Fade in and fade out screen ?

Postby Wertyboy » Mon Dec 27, 2010 11:31 am

Back! So who have fade out code without any variable?
User avatar
Wertyboy
 
Posts: 543
Joined: Tue Jun 15, 2010 12:38 pm
Location: HCM City, Vietnam
Score: 44 Give a positive score

Re: How to make Fade in and fade out screen ?

Postby needaname » Mon Dec 27, 2010 11:45 am

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;
needaname
 
Posts: 69
Joined: Tue Nov 09, 2010 2:07 am
Score: 4 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest