How to Use Sprites in GameMaker

What is a Sprite?

Sprites are the images you see when playing your game. The characters, items, and backgrounds you see are all examples of sprites. They’re an important part of any game!

Creating a New Sprite

You have a few options for making a new sprite.

Option 1: Right-click in the Asset Browser and select Create > Sprite.

Option 2: Press Alt+S

Option 3: Click on the + icon at the top of the Asset Browser, select Sprites, type in the number of new sprites you’d like to make, then click on Create.

The Sprite Editor

When you create a sprite, the Sprite Editor window will open. It looks like this.

Name the Sprite

You can name the sprite here. It’s a good idea to make it descriptive, and to give it a prefix that’ll let you know it’s a sprite when you’re referencing it in code. We like using the prefix "spr_“!

The Image Editor

GameMaker has a pretty good built-in Image Editor. If you’ve ever used the computer to draw a picture you’ve already got a good idea with how it works. To open the Image Editor and draw the sprite, click on Edit Image.

Importing Sprites

If you’ve already got an image saved somewhere that you want to put into GameMaker, click on Import. Learn how to import a sprite here.

Sprite Origins

A sprite’s origin is the point that corresponds to it’s position in the room. By default, the origin is in the top-left corner of the sprite, but moving it may make a difference to your game. Read more about Sprite Origins here.

Sprite Animation

A sprite can be a single image, or it can be multiple images that are displayed in a sequence to produce an animation! We call this an animated sprite.

Using Sprites

image_blend sets the tint color of the sprite.

image_angle sets the rotation of the sprite around the sprite’s origin.

image_xscale sets the horizontal scale of the sprite away from the sprite’s origin.

image_yscale sets the vertical scale of the sprite away from the sprite’s origin.

Texture Settings

Texture Settings are used to control how sprites are stored, displayed, and rendered in-game. The settings here can optimize a sprite’s properties in Texture Groups and Texture Pages.

Collision Mask

Each sprite has a Collision Mask that determines where the sprite’s boundaries are. This mask is used to detect when one object collides with another.

Read more about collision masks here.

Nine Slice Sprites

Nine-Slice scaling is a technique used to stretch a sprite’s middle parts while keeping its corners and edges intact. This technique is often used for UI elements like buttons, windows, and panels.

Read more about Nine-Slice sprites here.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top