Legacy GM Fade sprites

Sk8dududu

Member
This is embarrassing, but I cannot waste anymore time on this. I absolutely have no idea why this isn't working, especially since I copied this code from another project that I have and it works fine there.

I am using a controller to draw sprites during the intro of the game. The sprite fades in but I cannot get it to fade out. I've even checked the image alpha to see the number go down, it reaches zero but the sprite is visibly unchanged.

Create event
Code:
///Variables
intro = 0;
fade_alpha = 0;
//Logo fade in alarm
alarm_set(0,30);
//Logo fade out alarm
alarm_set(1,120);
Alarm 1
Code:
///Logo fade in
intro = 1;
Alarm 2
Code:
intro = 2;
draw event
Code:
if intro == 1
    {
    draw_sprite_ext(spr_intro6,0,room_width/2,room_height/2,1,1,0,c_white,fade_alpha);
    if fade_alpha < 1
        {
        fade_alpha += 0.005;
        }
    }
else if intro == 2
    {
    draw_sprite_ext(spr_intro6,0,room_width/2,room_height/2,1,1,0,c_white,fade_alpha);
    if fade_alpha > 0
        {
        fade_alpha -= 0.005;
        }
    }
It's so simple but my brain cannot understand the issue.
 
P

_Proxy

Guest
the code I use for fade in and fade out looks something like this
Code:
if (increase_alpha == true)
{
    alpha += 0.05;
    if (alpha >= 1)
    {
        alpha = 1;
    }
}

if (decrease_alpha == true)
{
    alpha -= 0.05;
    if (alpha <= 0)
    {
        alpha = 0;
    }
}
 

Sk8dududu

Member
the code I use for fade in and fade out looks something like this
Code:
if (increase_alpha == true)
{
alpha += 0.05;
if (alpha >= 1)
{
alpha = 1;
}
}
if (decrease_alpha == true)
{
alpha -= 0.05;
if (alpha <= 0)
{
alpha = 0;
}
}
Yes, and that looks exactly the same to me so I don't understand why mine isn't fading out.
 
P

_Proxy

Guest
ok this is what I do
Code:
// Create Event
increase_alpha = true;
decrease_alpha = false;

// Step Event
if (keyboard_check_pressed(ord("S"))
{
    increase_alpha = false;
    decrease_alpha = true;
}

if (increase_alpha == true)
{
    alpha += 0.05;
    if (alpha >= 1)
    {
        alpha = 1;
    }
}

if (decrease_alpha == true)
{
    alpha -= 0.05;
    if (alpha <= 0)
    {
        alpha = 0;
    }
}
you can see in my code that I have something triggering the decrease of the alpha by setting the decrease_alpha equal to true and the increase_alpha to false.

look at my video on counters as well instead of alarms:
if you want the counter to only happen once instead of looping remove the counter = 0; in the step event
 

Sk8dududu

Member
I can't use image_alpha or alpha as you call it because my object has no sprite. It's drawing multiple sprites.
I am switching the alpha increase and decrease to true at different points which I have verified is working using debug messages. I appreciate the attempted assistance but the alarms are not the issue because the alarms are activating.
 

Sk8dududu

Member
Is there an instance of the intro object in the room that has a sprite?
I actually solved the issue, but forgot to come back and say how.
My room settings didn't have draw the background colour checked. So without any background or drawing a colour, it was drawing the sprites like every frame and keeping them there.
 
Top