image_alpha
Returns: Real
This variable is used to get or to set the alpha value for the
sprite. Alpha is always calculated as a value between 0 and 1 where
0 is completely transparent and 1 is completely opaque. Please note
that for changes in this variable to be visible, the instance
should have either no draw event (and so GameMaker:
Studio will default draw the sprite) or be drawn using one of
the extended drawing functions like
draw_self() or
draw_sprite_ext().
NOTE: On the HTML5 and Windows8 (JavaScript) platforms,
this variable is not clamped. Therefore if you have a value greater
than one, it will "wrap" back to 0 again, giving flickering
results. Likewise if you go below 0, the alpha will "wrap" back to
1. You can use the function clamp
for this.
if image_alpha > 0 image_alpha -= 0.01;
The above code will slowly reduce the image_alpha until it reaches 0.