Assign an Action to an Object in GameMaker: Studio
You can think of Actions as the verb in a sentence: They tell the Objects what to do, when to do it, and how to do it. Actions are what causes a clown to bounce off the wall, or a plane to shoot a bullet, or an asteroid to split into pieces.
By using Actions, you save yourself from having to write the code yourself. Actions are great for game designers who are not proficient with writing their own code, and Actions provide an easier and quicker way for you to create a game.
If you want to write the code yourself, you can do that, but you still need to assign an Execute Code Action to an Event within the Object. Then you add your code to the Execute Code Action.
Here’s a quick, top-level procedure on how to assign an Action to an Object:
From the main menu, choose Resources→Create Object.
The Object Properties window appears.
Choose Add an Event from near the bottom-middle of the Object Properties window.
The Events menu appears.
Choose an Event, such as Create.
The Create Event appears in the Create section of the Object Properties window.
From the right side of the Object Properties window, drag and drop an Action icon — say, the Move Fixed Action — from the Move tab into the Actions section (see this figure).
The properties for the Action that you dragged and dropped appear.Drag and drop Actions from the Move tab to the Actions section.