How to Configure Sprites in GameMaker: Studio

By Michael Rohde

You can create Sprites in GameMaker: Studio. When you have your Sprite looking the way you want it, you can configure the Sprite with different properties. This includes placing the Origin, setting the Collision Checking (which includes modifying the Mask), and using the Texture Settings.

Using the Origin of a Sprite

The default anchor point, which is considered the Origin, is the top-left corner of a Sprite. GameMaker uses the Origin as a point of reference for rotating, scaling, and so on (for example, turning the image around when it bounces off a wall).

While in the Sprite Properties window, when you click Center (see this figure), you’re telling GameMaker to use the center of the Sprite as the anchor point (that is, the Origin).

Click Center to set the anchor point of the Sprite in the center.

Click Center to set the anchor point of the Sprite in the center.

Using Collision Checking

The Collision Checking settings are found in the middle of the Sprite Properties window (see this figure). Collision Checking refers to how the Object (an Object with the Sprite loaded) reacts when colliding with other Objects. You can select the Precise Collision Checking box for more accurate collision detection, but this could potentially slow down the game. You can also modify the Mask from the Sprite Properties window, as discussed next.

The Collision Checking settings.

The Collision Checking settings.

If your Sprite has sub-images, you can assign a separate Mask to each sub-image. To toggle this option, select the Separate Collision Masks in the Sprite Properties window.

To set the Mask, follow these steps:

  1. In the Sprite Properties window, click the Modify Mask button (refer to this figure).

    The Mask Properties window appears (see this figure).

    The Mask Properties window.

    The Mask Properties window.
  2. In the Image section, select the Show Collision Mask check box if you want the collision Mask to show in the editor; deselect the Show Collision Mask check box if you don’t want it to show.

  3. In the General section, select the Separate Collision Masks check box to use a separate collision mask for each sub-image.

    If you select the Separate Collision Masks check box, you can set the Alpha Tolerance. The higher you set the tolerance, the more the partially transparent pixels are not affected by the Mask. Pixels become transparent as the Sprite transitions between sub-images. It’s during these transitions that the Alpha Tolerance comes into play.

    By turning on Separate Collision Masks, you significantly increase the workload for GameMaker to run your game, which could cause performance issues.

  4. In the Bounding Box section, select Automatic, Full Image, or Manual.

    If you select Automatic, GameMaker does its best job of forming a Mask around the Sprite; if you select Full Image, GameMaker selects the entire image, including the transparent background; and if you select Manual, you can configure the settings yourself by typing in values in the Left, Right, Top, and Bottom fields.

  5. In the Shape section, set a more precise Mask shape by choosing Precise, Rectangle, Ellipse, or Diamond.

    If you select Precise, GameMaker does its best to set the Mask exactly against the pixels. If you choose Rectangle, Ellipse, or Diamond, GameMaker creates a Mask based on the chosen shape.

    When you select Precise, you significantly increase the workload for GameMaker to run your game (even more so than using a separate collision mask), which could cause performance issues.

  6. Click OK to save and close the Mask Properties window.

You can also fixtures instead of collision Masks, for when you want to make a physics-based game.