GameMaker 5 Examples

These examples have been written to help others learn how to do various things with GameMaker 5. Most of these were written to answer one or more questions posted in the GameMaker forums. These may not be the best way to do what they are doing, but they might help you. Feel free to make use of anything you find here in your own games.

Note: These examples were converted from Game Maker version 4 to Game Maker version 5 by Rupert Russell the original files are located at:

Example Name
Download Link
  All the following examples in one zip file (1,540 KB)
Ammo shows how to use a counter for ammo, including picking up objects for more ammo.
Background Music Shows how to queue multiple midi files, to be played one after the other.
Boardgame Shows simple movement around a square game board.
Bombs Shows how to track the order that bombs are placed, and detonate them in order (D key detonates the bombs)
Boomerang Shows how to create a boomerang effect.
Buttons Shows a simple way of creating a set of buttons that can be selected with the keyboard.
Cards A playable game of Pyramid Solitaire (generic but good to see an easy way to shuffle and deal cards)
Centered Keep a player centered in the screen while scrolling.
Coins Shows how to open a secret door, after 4 coins are picked up.
Color Shows how to get the RGB values from the Decimal color code.
Dice Shows how to use Dice in GM (With an image of a die) Good for a board game.
Direction A good multi-purpose example, showing 2 player (one system) movement are fireing in 8 directions.
Display Shows how to add a mouseover popup with information about an object.
Drawname Asks for your name, then draws it on the screen.
Energy Shows how to place an energy bar in the lower left corner of the screen.
Explosion An object in the middle of the screen blows into a LOT of little pieces.
Face Mouse Shows how to keep the player facing the mouse pointer.
Fire Shows how to make an emeny fire continously.
Fog of War Shows one way to do a fog of war.
Gas Shows how to use Gas in a car, No gas=no movement. Complete with gas pumps and multiple cars, each with it's own amount of gas.
HealthBar Shows how to easily add a health bar to any object in your game.
Hearts Shows how to use hearts, simular to Zelda (so I am told).
HighScores An object and scripts to add multiple highscore tables to a game.
Horizontal Shooter An example of a horizontal space shooter.
Invaders An example of a simple Space Invaders clone.
Inventory An example showing how to add inventory slots to a game, with only certain types of inventory allowed into a given slot.
Line Editor Show how to do a simple line editor, to edit a text file.
Lives Shows how to add and remove lives, and represent them with a heart in the corner of the screen.
Mouseshoot shows how to use the mouse as a crosshair, to aim your shots.
On Road shows how to make a police car stay on the road. Primative, and probably not the best way to accomplish it, but it works. Will need some tweeking to look good in a game.
Pacman Shows how to buffer a movement command, until it can be used.
Paralax Scrolling A simple way to do paralax scrolling backgrounds
Radar An example showing how to have a radar track multiple objects, and display their position.
Radar Version 2 Above example Modified by Chronic, to display ANY object in the room
Relative Shows how to display the players score above their head, as they move around.
Shot Chase Demonstrates how to fire toward an object and also how to do homeing missle shots.
Snake An example showing the Movement and Growth in the classic "Snake" type game.
Spiral Shows how to make a bunch of objects spiral away from a centeral object.
Talk An example of a 15 line text display, for use in RPG's for character dialog.
Timer Shows how to add a timer to a game. Uses a timer bar at the top left of the screen.
Two Shots Demonstrates alternating shots from both sides of an object.
Vertical Shooter Example of a vertical space shooter.
Walk Around Shows how to get a player to walk around a block in it's way.
Examples by Alex LeDoux and KoolKitty
Board Game This will help you write your own board games.
Menu An easy to use autorun menu system.(KoolKitty also claims authorship of this example)
Slot Machine Shows how to do a slot machine. NOTE: Images are copyrighted by Alex. You must change them in your own game.

I hope these are of some use to you. I will keep adding here, as I write more examples for people from the forums.

If you are needing an example written to show how to do something with GameMaker, feel free to ask, and if it is something I can help you with, I will.