GameMaker: Studio

GameMaker: Studio

View Stats:
Aptivon Jan 14, 2017 @ 5:03pm
how can a make a sprite fade in and out?
hey, i'm currently trying to make my logo fade in for one second, stay for 1 second and then fade out for 1 second.
is there any way to do this?
ty
< >
Showing 1-5 of 5 comments
Etredal Jan 14, 2017 @ 5:20pm 
you can use image_alpha
2IndieDev. Jan 14, 2017 @ 5:22pm 
or just do it in the animation
Aptivon Jan 14, 2017 @ 5:24pm 
Originally posted by Etredal:
you can use image_alpha
tried this, but it doesn't really work for some reason. ty tho



Originally posted by 2 Indie Dev.:
or just do it in the animation
think i'll do this. ty
Diveyoc Jan 14, 2017 @ 7:02pm 
I'd recommend learning and experimenting with the code. There's probably a lot of similar stuff you'll want to do down the road.
You need to use draw_sprite_ext for your logo:
draw_sprite_ext( sprite, subimg, x, y, xscale, yscale, rot, colour, fade_alpha );

For the alpha, use a variable such as (fade_alpha) like I have inserted above.
Now, however you change the code for fade_alpha will change the alpha of your logo.

In the create event, set fade_alpha to zero so you can't see it..

Create Event:
fade_alpha = 0;

Step Event:

fade_alpha += 0.009;

if (fade_alpha >= 1)
{
fade_alpha -= 0.009;
}

This isn't the exact code you want, but hopefully you get the idea. You could get the accurate timing you want by using a variable for a timer or just use alarms. Personally I like to use a variable and create my own timers.
Last edited by Diveyoc; Jan 14, 2017 @ 7:03pm
Aptivon Jan 15, 2017 @ 8:38am 
Originally posted by Diveyoc:
I'd recommend learning and experimenting with the code. There's probably a lot of similar stuff you'll want to do down the road.
You need to use draw_sprite_ext for your logo:
draw_sprite_ext( sprite, subimg, x, y, xscale, yscale, rot, colour, fade_alpha );

For the alpha, use a variable such as (fade_alpha) like I have inserted above.
Now, however you change the code for fade_alpha will change the alpha of your logo.

In the create event, set fade_alpha to zero so you can't see it..

Create Event:
fade_alpha = 0;

Step Event:

fade_alpha += 0.009;

if (fade_alpha >= 1)
{
fade_alpha -= 0.009;
}

This isn't the exact code you want, but hopefully you get the idea. You could get the accurate timing you want by using a variable for a timer or just use alarms. Personally I like to use a variable and create my own timers.
thank you. i'll try this :)
< >
Showing 1-5 of 5 comments
Per page: 1530 50

Date Posted: Jan 14, 2017 @ 5:03pm
Posts: 5