cursor_sprite

Setting this variable will instruct GameMaker to use the designated sprite as a cursor (basically setting it to the current mouse x/y position every step).

The default value is -1 which is no sprite for the cursor, but you can assign any sprite index from the game assets or that has been imported from an external resource. Please note that there is no way to control the animation speed or image index, so if the sprite has sub-images, these will be cycled at the same speed as the game speed. To remove the cursor sprite, you can set this variable to -1 again.

NOTE This variable does not replace the game window cursor, and that it will still be drawn as normal. To avoid this you can use the function window_set_cursor and set it to the constant cr_none which will make the standard cursor invisible.

 

Syntax:

cursor_sprite

 

Returns:

Sprite Asset

 

Example:

cursor_sprite = spr_custom_cursor;

The above code sets the sprite indexed in the variable spr_custom_cursor to be the cursor sprite for the game.