How to Work with Sprites in GameMaker: Studio

By Michael Rohde

A Sprite is an image, or a series of sub-images, that you assign to Objects. You can use Sprites to represent Objects in the game, such as the player (a ship or a character), explosions, walls, score displays, or anything you want in your game.

When a Sprite consists of a series of images, those images are known as sub-images, and they play continuously, as if they were mini-movies. That can give the appearance of a plane’s propellers rotating, an animated explosion, and so forth. Each sub-image within a Sprite is named consecutively (image 0, image 1, image 2, and so on), as shown in this figure.

The Sprite Editor showing sub-images.

The Sprite Editor showing sub-images.

Just as in programming, which starts counting at 0, the sub-image numbering starts at 0 as well.

If you don’t want the Sprite to play continuously, you can tell GameMaker to display a specific sub-image of your choice. You can even tell GameMaker to choose a sub-image at random.

Loading and creating sprites

To load a Sprite that already exists, follow these steps:

  1. Click the icon that looks like Pac-Man from the icon menu (see this figure).

    Click this icon to create a new Sprite.

    Click this icon to create a new Sprite.
    The Sprite Properties window.

    The Sprite Properties window.

    The Sprite Properties window appears.

  2. Click the Load Sprite button (refer to this figure).

    A navigation menu opens from which you can find an image on your computer.

Create a sprite from scratch

To create a new Sprite from scratch, follow these steps:

  1. Click the icon that looks like Pac-Man from the icon menu.

    The Sprite Properties window appears.

  2. Click the Edit Sprite button in the Sprite Properties window.

    The Sprite Editor window appears.

    The Sprite Editor window.

    The Sprite Editor window.
  3. Choose File→New.

    The Create a New Sprite dialog box appears.

    The Create a New Sprite dialog box.

    The Create a New Sprite dialog box.
  4. In the Width and Height fields, type in the dimensions you want the Sprite to be.

  5. Click OK.

    A new Sprite, which consists solely of a transparent background at this point, appears in the Sprite Editor. You can now double-click this Sprite to open the image editor from which you can actually draw the Sprite.

To create a sub-image, you can choose one of the Create an Empty Image icons in the Sprite Editor to add the sub-image either before the current one or at the end. A new, blank sub-image appears in the Sprite Editor.

The Sprite Editor with three sub-images.

The Sprite Editor with three sub-images.

Editing sprites

GameMaker has a built-in Image Editor (see this figure) that you can use to edit Sprites. To access the Image Editor, click Edit Sprite from the Sprite Properties window. Then double-click the image that you want to edit.

The in-software manual goes into detail on the Image Editor. Just press F1 in GameMaker to access the manual. Then choose the Index, search for “image editor,” and then choose Display at the bottom of the window.

GameMaker’s Image Editor for Sprites.

GameMaker’s Image Editor for Sprites.