如果正在检查的鼠标按钮被按下,则该函数将返回 true,否则返回 false。
您提供鼠标按钮来检查以下常量之一:
鼠标按钮常数 | |
---|---|
常量 | 描述 |
mb_left | The left mouse button |
mb_middle | The middle mouse button (this may not be valid for all target platforms) |
mb_right | The right mouse button |
mb_side1* | Mouse side button 1 |
mb_side2* | Mouse side button 2 |
mb_any | Any of the mouse buttons |
mb_none | No mouse button |
*注意 mb_side1和mb_side2按钮仅用于Windows,macOS,Ubuntu和html5。
mouse_check_button(numb);
参数 | 类型 | 描述 |
---|---|---|
numb | 鼠标按钮常数 | 要检查哪个鼠标按钮常数。 |
if mouse_check_button(mb_left)
{
instance_create_layer(mouse_x, mouse_y, "Effects", obj_Star);
}
上面的代码将检查鼠标左键,并且按住它的每一步都将创建在 obj_Star 中索引的对象的实例。