Game Maker: Object Following the Mouse

by Quotingmc in Circuits > Computers

56 Views, 0 Favorites, 0 Comments

Game Maker: Object Following the Mouse

2014 11:01 PM.jpg
A great way to create custom mouses or sights in your games on game maker!

For this tutorial you will need a basic knowledge in game maker and the standard version.

If you want it to happen once on loading use the create event, if you want it to follow the mouse use a step event.

Remember to turn off the cursor in game properties though.

Aligning the Object With the Mouse

To align an object with the mouse we use a simple piece of code:

/sets x of object to x of mouse
x = mouse_x
/sets y of object to y of mouse
y = mouse_y

You can also add to the end of these statements to expand on them, for example:

Y = mouse_y + 10