image_alpha


描述

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 2 will default draw the sprite) or be drawn using one of the extended drawing functions like draw_self() or draw_sprite_ext().


语法:

image_alpha;


返回:

Real (between 0 and 1)


例如:

image_alpha = clamp(image_alpha - 0.01, 0, 1);

The above code will slowly reduce the image_alpha until it reaches 0.