• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM [SOLVED] Transition

W

Wuzzems

Guest
I have an object whose image_alpha I want to gradually increase and then go to the next room. Here's the code that I've made for it. I'm referencing it from another object though.

Code:
if (mouse_check_button_released(mb_left)) && (mouse_x > (room_width/2)-64 && mouse_x < (room_width/2)+64) &&

                                            (mouse_y > (room_height/2)-32 && mouse_y < (room_height/2)+32)
    
    {
    released = 1;
    }

    
    
        
    if (released == 1) && (obj_transition.image_alpha < 1)
        {
        image_alpha += 0.01;
        }

            if (obj_transition.image_alpha == 1)

            {
            room_goto(room0);
            }
The "released" variable I made in the create event.

Clicking and releasing on the area I specify seems to do nothing. Changing the alpha directly from obj_transition seems to trigger the final part of the code and go to the next room. So what's causing it not to increase the image_alpha?

Any help is appreciated.
 

matharoo

manualman
GameMaker Dev.
Code:
obj_transition.image_alpha += 0.01;
You're checking for the alpha of obj_transition but you're changing the calling instance's alpha. You need to specify the instance/object.
 
W

Wuzzems

Guest
Oh lol. It hit me like a brick when I saw that. Thanks for the help.
 
Top