YoYo Games Wiki

Custom Cursor

From YoYoGames Wiki

This is how you can create your own mouse cursor in Game Maker. Pro version is not required.

NOTE: These methods to not hide your mouse cursor. It will need to be disabled in the Global Game Settings by unchecking the "Display the cursor" option.

METHOD 1

Step 1 : Load the cursor image into Game Maker as a sprite. You can also use animated sprites as cursors.
Step 2 : Create a new object resource. Name it "obj_mouse". Assign your new sprite to this object.
Step 3 : Add a Step event to this new object. In the Step event, add the "Jump to Position" action. Change the x and y values to mouse_x and mouse_y.
Step 4 : Place the obj_mouse object in any rooms where you'd like a mouse cursor to appear.

This method also allows you much better control of the mouse in your games. You can assign a mask to your mouse object and create collision events to make the cursor interact with game objects. You can assign different sprites to the mouse at any time in the game, and you aren't limited to a certain size.

METHOD 2

Step 1 : Load the cursor image into Game Maker as a sprite. You can also use animated sprites as cursors.
Step 2 : Create a new room resource, or edit an existing room.
Step 3 : Click the Settings tab for your room. Click Creation Code
Step 4 : Add the following GML to the code box which appears. Where <sprite> is the name of your cursor image.
cursor_sprite = <sprite>

While this method cannot generate collision events, it can use the mouse events.

This article is a stub, please help the YoYo Games Wiki by expanding it.