draw_clear_alpha


描述

这个函数可以用指定的颜色和透明度填充整个屏幕,屏幕原有图像的透明度保持不变 - 这个函数 会对原有图像的透明度与混合模式做任何修改。随后你可以再次修改其混合操作。This is only for use in the draw event of an instance (it will not show if used in any other event), and it can also be very useful for clearing surfaces when they are newly created.

当使用HTML5模式的时候需要注意,你可以使用本函数使一个canvas背景透明,它允许你在游戏运行的时候从网络上载入一些图像。To achieve this effect you must first go into the room editor and remove any Background Layers from the Room Editor, then untick the option Clear View Background found on the View Properties. Finally, you will need to make a new object, place it in the first room of the game, and assign it a very high depth (for example, 10000). Then in the Pre Draw event use this function to set the canvas alpha to the colour and transparency that you wish it to have.


语法:

draw_clear_alpha(col, alpha);


参数 描述
col 用来填充屏幕的颜色
alpha 用来填充屏幕的颜色的透明度


Returns:

N/A(无返回值)


例如:

draw_clear_alpha(c_red, 0.5);

This will clear the screen with 50% (0.5) transparency with the colour red.