Skip to content

A1 - Introduction to GameMaker Studio

GameMaker Login Information

Username: stewart_eastview.8609

Password: Wildcats421!

GameMaker Studio, often abbreviated GMS, is a platform for creating 2D games that is beginner friendly. For the purpose of our course, it will lead us into concepts related to Object Oriented Programming.

GameMaker Assets

Game Engines all have assets: bits and pieces of things that come together alongside the code to create the game. Below, the assets within GMS that we will be working with in this assignment are introduced.

Sprites

In GMS, a sprite simply represents either an image or a single animation consisting of several images. This is in contrast to languages such as Scratch, where a sprite may contain multiple images/animations as well as defined behaviour of a character.

Objects and Instances

An object in GMS is the asset that is most closely related to a sprite in Scratch. In GMS, an object is usually (but not necessarily) assigned a sprite, and an object's sprite can be swapped out depending on certain conditions, for example whether the sprite is walking right, left, jumping, etc.

In GMS, the object is the template for creating instances, similar to how a cookie cutter is a template for creating cookies. All behaviours and scripts are defined in the object, and then we may add as many instances as we'd like of that object into our game. This is very useful for things like enemies and items, where we usually would use multiple copies of the same thing in our program.

If you're familiar with Object Oriented Programming (OOP)

The terminology here is a little confusing:

  • An object in GMS is analagous to a class in OOP
  • An instance in GMS is usually called an object or instance in OOP

Rooms

The world within which instances of our objects exist.

Other Assets

As you will notice by exploring the GMS asset browser, there are many more assets available. Later in this unit we'll also introduce tilesets, but if you have time you could also explore some of the others on your own.

Naming Conventions

For naming variables, we'll use the Python convention (separating multiple words by underscores), since it coincides with GMS built-in variables and functions.

Assets are also all named, using the same rules as naming variables. For these we will use the convention:

prefix_name
The prefix indicates the asset type. We'll use the following abbrevations:

  • spr for sprites
  • rm for rooms
  • obj for objects
  • ts for tilesets
  • sprTs for sprites that will be used as tilesets, as we will see in a later assignment.

As an example, suppose we have a player object with four different animations - one for each direction it walks. We would have the following assets:

// Four sprite assets
spr_player_walk_right
spr_player_walk_left
spr_player_walk_up
spr_player_walk_down

// One object asset, that will use each of the above sprite assets as needed
obj_player

Your Task

A video demonstration is available here

  • Open GameMaker Studio. Skip the Welcome Tutorial if it tries to show it to you.

  • New -> New Blank -> Assignment 1

  • If you are working within Google Drive, you'll likely start getting lots of warnings about files being changed from outside GMS. Anytime you get this warning, just click the Save button, but you can disable these warnings under:

    • File -> Preferences -> General Preferences -> File Watcher: Uncheck Enable File Watcher
  • In the Rooms folder within the asset browser, rename Room 1 to rm_main to match our conventions

  • Right click the Sprites folder; Create -> Sprite. Name the sprite spr_blue. You can change it later if you decide to paint something other than just a blue square.

  • In the sprite editor, click the Edit Image button. Use the paint can tool to fill the full image solid blue, or draw something else if you'd like. Close the image editor window and then the sprite window when you're done.

  • Create another sprite in the same manner called spr_green, or a different appropriate name if you paint something different.

  • Right click on the Objects folder; Create -> Object. Name the object obj_blue.

  • Click the No Sprite button and navigate to your spr_blue sprite.

  • Under Events click Add Event and add a new Step event. If it asks you if you want to use GML Code or Visual, choose code. You can also check the boxes that prevents it from asking you again.

  • In the code, just add the line x += 1

  • Create a similar object for your green sprite. Change the code slightly; for example you could try y += 1 or x += 2

  • Close your object windows, and open rm_main

  • Drag two instances of each of your objects into the room

  • Run the project and see if it behaves as expected.