How to make Object face the Mouse in GameMaker Studio 2/Studio/8/8.1

Hello game developers, today I will show you how to make an object faces the mouse in GameMaker Studio 2 or GameMaker Studio or GameMaker 8/8.1.

Usually we utilize this feature in a 'Shooter' games. To make an object faces the cursor all we need is only 2 lines of code.

You can continue reading or watch this video:


This method will be the same on ALL versions of GameMaker.

1. Add a 'Step' event to your object
2. After that, go to 'Control' tab and then add 'Execute Code' to the 'Step' event.
3. And then insert the following code into the 'Execute Code' action:

image_speed=0

image_index=point_direction(x,y,mouse_x,mouse_y)


4. Done! Test it out and it supposed to follow your mouse angle.


Thanks for reading, hopefully this tutorial helped you. And don't forget to check out my YouTube Channel:

youtube.com/Freadel


If you have any question, feel free to ask in the comment section down below or through the mentioned video's comment above. (I will more likely reply if it is asked through the mentioned video's comment section)


tags: How to make Object face the Mouse in Game Maker Studio 2/Studio/8/8.1, How to make Object face the Mouse in GameMaker Studio, How to make Object face cursor in GameMaker Studio 2/Studio/8/8.1, make an object faces cursor in GameMaker studio, make an object faces cursor in GameMaker 8.1, GameDev, DevLog, Game Developer, Developer, Programmer, Coding,Gaming, Indie game developer


Post a Comment

0 Comments