How to Use Speed and Movement in GameMaker: Studio

By Michael Rohde

When working with Views in GameMaker: Studio, keep in mind that it is the View that has speed and moves, which affects what the player sees on his screen.

Therefore, some Objects, such as the planes from the Scrolling Shooter tutorial, will have a vertical speed (to stay in view and not be dragged off the screen as the View moves), and other Objects, such as the islands, will not have speed (so that they move along with the View, and are dragged off the screen).

The Room doesn’t move; it’s the View that moves. In that sense, the Room coordinates are absolute, while the View coordinates for Instances are relative to their position within the Room.

You may want to complete the first part of the in-software Scrolling Shooter tutorial so that you have all the Objects mentioned in the following procedures ready to go.

To add speed to an Object, follow these steps:

  1. Create an Object, such as the plane from the Scrolling Shooter tutorial, by choosing Resources→Create Object.

  2. Choose Add Event→Create.

    The Choose the Event to Add menu appears.

  3. Choose Create from the Choose the Event to Add menu.

    The Create Event appears in the Events section.

  4. Drag and drop the Vertical Speed Action from the Move tab into the Actions section.

    The Speed Vertical window, shown in this figure, appears.

    The Speed Vertical window.

    The Speed Vertical window.
  5. In the Speed Vertical window, enter –2 in the Vert. Speed field.

    A negative speed allows the Object to move up the Room; a positive speed allows the Object to move down the Room.

  6. Click OK to save and close the Speed Vertical Action.

Rooms, Views, and the screen are separate entities. For example, the View can rotate, so an Instance can still move down the Room, but it will appear to be moving across the screen (because the View was rotated).