draw_set_alpha

Sets the base alpha blend for the draw functions.

Syntax:

GML Code Example

draw_set_alpha(alpha);


Argument Description
alpha The alpha to set (between 0 and 1)


Returns: N/A


Description

With this function you can set the base draw alpha for the game. This value can be set from 0 to 1 with 0 being fully transparent and 1 being fully opaque (the default value), and will affect all further drawing, including backgrounds, sprites, fonts, primitives and 3D. If any of those assets are drawn with their own alpha value changed, this will be added to the base alpha value set by this function, so a base alpha of 0.5 and a sprite being drawn with an alpha of 0.5 will actually draw the sprite with an alpha of 0.25.


Example:

GML Code Example

draw_set_alpha(0.5);
 draw_set_colour(c_black);
 draw_text(x+5, y+5, "LEVEL 1");
 draw_set_alpha(1);
 draw_set_colour(c_white);
 draw_text(x, y, "LEVEL 1");
 

The above code will draw some text at the specified position with a shadow effect created by modified draw alpha and colour.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here