[Tutorial]Fade in and Fade out (VERY EASY)

Learn to use DS Game Maker by Example!

[Tutorial]Fade in and Fade out (VERY EASY)

Postby RDilux » July 18th, 2011, 2:24 pm

I had alot of problems making fade in and fade out on DSGM 5.
But i got a solution for everyone now!!!

Create 2 objects and name them like fade_in_obj and fade_out_obj.

In fade_in_obj we gonna do it like this

Event Type: Create
Declare i as Type s8 with a value of 0 (i;s8;0)
Loop i from -16 to 0 (i;-16;0)
-- start block
-- Set bottom screen brightness to i (bottom;i)
-- Set top screen brightness to i (top;i)
-- Wait for VBL
-- end block
Delete object


In fade_out_obj we gonna do it like this

Event Type: Create
Declare i as Type s8 with a value of 0 (i;s8;0)
Loop i from 0 to 16 (i;0;16)
-- start block
-- Set bottom screen brightness to i (bottom;i)
-- Set top screen brightness to i (top;i)
-- Wait for VBL
-- end block
Delete object

thats it
now just in you're action do create object and done!
RDilux
 
Posts: 12
Joined: June 17th, 2011, 6:30 pm

Re: [Tutorial]Fade in and Fade out (VERY EASY)

Postby AnimeKingL » May 27th, 2012, 1:26 pm

Hey, shouldn't it be from 0 to -16 for a fade out, that way the two fades smoothly transition? Im just asking though, im a noob lol :D
Currently Working on: Fable For The Gods
AKL is my company :3
AnimeKingL
 
Posts: 46
Joined: March 12th, 2012, 2:58 pm
Location: Tx

Re: [Tutorial]Fade in and Fade out (VERY EASY)

Postby Foxi4 » May 27th, 2012, 4:53 pm

You can't loop backwards in DSGM without making a custom for() Loop, the Action is fixed on incrementation (adding), thus going from 0 to -16 is impossible with the Action. If you want to do that, you go from 0 to 16 and Set Brightness to -i. ;)
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1114
Joined: December 31st, 2010, 3:25 am

Re: [Tutorial]Fade in and Fade out (VERY EASY)

Postby AnimeKingL » May 27th, 2012, 5:18 pm

Thanks :D
Currently Working on: Fable For The Gods
AKL is my company :3
AnimeKingL
 
Posts: 46
Joined: March 12th, 2012, 2:58 pm
Location: Tx

Re: [Tutorial]Fade in and Fade out (VERY EASY)

Postby Foxi4 » May 27th, 2012, 5:55 pm

You're welcome. ;)
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1114
Joined: December 31st, 2010, 3:25 am

Re: [Tutorial]Fade in and Fade out (VERY EASY)

Postby Buck_7 » May 27th, 2012, 7:20 pm

...and i'll stick an example here to make things easier. For some reason, I couldn't make a version where you fade white.
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 964
Joined: February 19th, 2011, 1:44 am

Re: [Tutorial]Fade in and Fade out (VERY EASY)

Postby Bobbyloujo » June 1st, 2012, 12:52 am

Buck_7 wrote:...and i'll stick an example here to make things easier. For some reason, I couldn't make a version where you fade white.

Pretty good. You don't need the fade in at the end because you already have one at the beginning. Also, you didn't specify the layer in the change background actions which could've confused someone.

Here's one without the fade in at the end and one that fades to white.

Edit: it goes kinda fast without the Sleep for 2 seconds at the end but you get the idea. Also, do you see the difference in file sizes between the two? They're almost exactly the same but one's double the size. Weirdddd.
Attachments
Fade Example White.dsgm
(18.35 KiB) Downloaded 50 times
Fade Example.dsgm
(9.69 KiB) Downloaded 38 times
Seriously never posting again, lawlz.
jk
Bobbyloujo
 
Posts: 1295
Joined: December 30th, 2010, 8:40 pm
Location: Uh-merica

Re: [Tutorial]Fade in and Fade out (VERY EASY)

Postby Foxi4 » June 1st, 2012, 1:15 am

*snip* Nevermind.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1114
Joined: December 31st, 2010, 3:25 am

Re: [Tutorial]Fade in and Fade out (VERY EASY)

Postby Bobbyloujo » June 1st, 2012, 3:19 am

Foxi4 wrote:*snip* Nevermind.

Now I'm curious -.-
Seriously never posting again, lawlz.
jk
Bobbyloujo
 
Posts: 1295
Joined: December 30th, 2010, 8:40 pm
Location: Uh-merica

Re: [Tutorial]Fade in and Fade out (VERY EASY)

Postby Foxi4 » June 1st, 2012, 10:49 am

I was going to say that using WaitForVBL or Sleep is not the best of options since you're dropping frames and it's far better to simply use a loop of an appropriate size for your fading effect, but then I figured that the drop in performance is usually so small that it's mostly negligent.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1114
Joined: December 31st, 2010, 3:25 am

Re: [Tutorial]Fade in and Fade out (VERY EASY)

Postby Buck_7 » June 1st, 2012, 11:06 pm

Bobbyloujo wrote:
Buck_7 wrote:...and i'll stick an example here to make things easier. For some reason, I couldn't make a version where you fade white.

Pretty good. You don't need the fade in at the end because you already have one at the beginning. Also, you didn't specify the layer in the change background actions which could've confused someone.

Here's one without the fade in at the end and one that fades to white.

Edit: it goes kinda fast without the Sleep for 2 seconds at the end but you get the idea. Also, do you see the difference in file sizes between the two? They're almost exactly the same but one's double the size. Weirdddd.


Thanks! I see how it's done now.

Foxi4 wrote:I was going to say that using WaitForVBL or Sleep is not the best of options since you're dropping frames and it's far better to simply use a loop of an appropriate size for your fading effect, but then I figured that the drop in performance is usually so small that it's mostly negligent.


Here's another version. You can press anykey (except for the power button on a DS) to skip the splash screens. This was taken from a PAlib example and it doesn't use sleep.
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 964
Joined: February 19th, 2011, 1:44 am


Return to Tutorials & Examples

Who is online

Users browsing this forum: No registered users and 1 guest

cron