• 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!

How to make object fade when key not pressed and then opaque when it is pressed?

F

FactorX12

Guest
So I am trying to make an inventory that is completely opaque when the player holds the tab key, and then fade out when the player releases the tab key. Is this possible? This is my current code:
[in the step event]:
check_tab = keyboard_check(vk_tab);
image_alpha -= 0.05;
if check_tab {
image_alpha = 100;
}
the problem with this is it fades out in the beginning, it appears when the tab key is pressed, but when the tab key is released, it stays opaque and does not fade out. any help at all?
 

Simon Gust

Member
That's because it will take 33 seconds for you to notice that it becomes opaque. Usually, 100% opaque is at an image_alpha value of 1, not 100.
 
Top