Move Directional Actions in GameMaker: Studio - dummies

Move Directional Actions in GameMaker: Studio

By Michael Rohde

In GameMaker: Studio, the Move tab is the first tab in the Object Properties window. Here is a list of each of the actions that you can assign to Objects.

In the following definitions, the term Instance is used to refer to what the Action is affecting. However, you configure the Action in the Object Properties window. Remember that an Instance is simply an Object that you’ve placed in the Room.

The Move tab in GameMaker.
The Move tab in GameMaker.

The Move directional arrows apply to the movement, direction, and position of an Instance. They include the following Actions (see the next figure):

  • Move Fixed: This action starts an Instance moving in a specified or random direction. Also, it includes the speed you want the Instance to move, which is based on pixels per step.

  • Move Free: Use this Action to have the Instance move at a specific angle between 0 and 360 degrees. If you use 0, the Instance moves to the right, a 90-degree angle moves the Instance up, and so on. You can also use random (360) to specify a random movement.

    If you select Relative for this Action, any new motion is added to the current motion. Say the Instance is moving up, and then something happens during the game to cause the Instance to move left. If you select Relative, the Instance will start moving up and to the left.

  • Move Towards: This action enables you to send an Instance toward another Instance. You can set the speed of the Instance and then use the coordinates of another Instance as the direction for it to move in.

    An example could be player.x, player.y (where player is the Instance you want your Instance moving toward. An example would be shooting guided bullets in a Room with a View (but this will work even if you’re not using Views).

  • Speed Horizontal and Speed Vertical: Use this Action to set the Speed of an Instance.

  • Set Gravity: For gravity, you can set the direction you want the gravity to pull the Instance by using the degree of an angle. When you start to experiment, begin with a slow speed of say, 0.01. Gravity is cumulative, in that an Object will pick up speed, such as a boulder would do as it rolled down a mountainside.

  • Reverse Horizontal and Vertical: This Action is great for when an Instance collides with another Instance and you want the Instance to reverse direction.

  • Set Friction: This Action slows down the Instance. For each step of the game, friction slows the Instance by the amount that you set. You may want to start with a small amount of friction, such as 0.01.

    The Move Actions from the Move tab.
    The Move Actions from the Move tab.