EXAMPLES

Below are some examples of how to accomplish certain game tasks with GameMaker.
Some might call it "tutorials", but the only explaining texts are the comments in the game code. I have tried to comment as much as I can.

TypeWriter example 3 (added 2003-01-09) (updated 2003-10-09): Downloads:
Just changed the typewriter example so that it now gets the text from within Game Maker, and not from an external text file.
2003-10-09: Converted the file to 5.1 format and fixed a bug that appears when running in the new GM version.

Menu rollover example (by Andy Nicholas) (added 2003-10-08): Downloads:
A nice example showing "rollover" meny buttons with sound. Thanks to Andy Nicholas for this example.

Screen Shot example (by Misturx) (added 2003-10-08): Downloads:
This example, written by Misturx, shows how to take screenshots, save them and to print them.

Dekker's particle example (by Dekker) (added 2003-09-29): Downloads:
A particle example by Dekker.

Fountain particle example (by Lean C) (added 2003-09-26): Downloads:
Another example by Lean C. This one shows a nice fountain effect using a little particle system. No, this example does not either use the new Particle feature of Game Maker 5.1.

Fire particle example (by Lean C) (added 2003-09-26): Downloads:
This example shows how to make fire using dynamic creation of objects. No, it does not use the new Particle feature of Game Maker 5.1. Thanks to Lean C for this example.

Registration example (by tsg1zzn) (added 2003-09-08): Downloads:
Another example by tsg1zzn. This one shows how you can make a registration code work for your games or applications.

MDI example (by tsg1zzn) (added 2003-09-08): Downloads:
This example, by tsg1zzn, shows how to have one or multiple "slave windows" that mimics actions in the "master window".

Level Writer example (added 2003-09-08): Downloads:
On request I have now made an example that shows how to write a level to a text file too. Otherwise, it looks similar to the "Level Reader" example below. When running this example, a "level file" is created. It is basically just a text file containing level information. Load it up in a text editor and check it out.

Pause menu example (by Skiracer901) (added 2003-07-11): Downloads:
A quite advanced example of how you can make a nice pause feature with a menu. Written by Skiracere901, slightly modified by me.

Joystick examples (by Rob Clark) (added 2003-07-01): Downloads:
A collection of three joystick examples, written by Rob Clark. Since I do not currently have access to a joystick, I have not tested them myself. :)

Updated Random Landscape Generation example (original by Carl, modified by Rob Clark) (added 2003-07-01): Downloads:
Rob Clark has updated my Random Landscape Generation example. It is now much more efficient when it comes to instance creation. Also, the graphics is much spiffier :) .

Status bar regeneration example (by Scattershot5683) (added 2003-07-01): Downloads:
This example shows a "regenerating" status bar for the gun of a spaceship. Written by Scattershot5683.

Writeln example (by tsg1zzn) (added 2003-07-01): Downloads:
Example of a writeln script, written by tsg1zzn.

3D Stereogram example (Carl's 3D cube example modified by Dirk van den Bekerom) (added 2003-06-11): Downloads:
This example is based on the 3D cube example far below. It shows two cubes slightly rotatet and moved related to each other, giving a kind of moving 3D stereogram image. Unfortunately I have always been unable to "see" these things, but I hope you can! :) Modified by Dirk van den Bekerom.

Star Wars-looking intro example (original by Carl, modified by Clay Triche) (added 2003-06-06): Downloads:
This example shows how you can make an intro that resembles the famous Star Wars intro quite a lot, even though the text is not tilted in that way, an it moves a bit shakily. :) Thanks to Clay Triche for all the credits he gave me in this example.

Modified 360 degrees movement with animated sprite (modified by Lars Peter "Weird Dragon" Schultz) (added 2003-06-04): Downloads:
Lars Peter has modified my 360 degrees movement example so that the moving object is now always facing the mouse pointer location.

Simple Command Prompt example (by tsg1zzn) (added 2003-05-23): Downloads:
An example that shows how you can implement a command-based interface. Written by tsg1zzn.

Isometric Movement example (by Stephen Shellard) (added 2003-05-23): Downloads:
This exaple, written by Stephen Shellard, depicts how you can implement isometric movement with the mouse. Click, and the player object will follow.

Enemy Hits example 2 (by Andrew Nicholas) (added 2003-05-23): Downloads:
Updated version of previous Enemy Hits example. This time the enemy strikes back. Written by Andrew Nicholas.

Enemy Hits example (by Andrew Nicholas) (added 2003-05-08): Downloads:
The example shows how you can do so that an enemy takes multiple hits before being destroyed. Written by Andrew Nicholas.

Fire particle example (by Martijn) (added 2003-05-07): Downloads:
This example shows how you can make a fire with particles. There are lots of variables that can be changed to control the fire. Written by Martijn.

Heat seeking missile example (by Sleepwalker) (added 2003-05-05): Downloads:
Sleepwalker's Heat seeking missile example. The missile tracks a target, but has a possibility to miss if the target moves too much, which brings it a bit closer to reality.

Sound on/off example (by Sleepwalker) (added 2003-04-28): Downloads:
How to turn on or off the sound in a game using a sound controller. Written by "Sleepwalker".

Rotation and shooting example (by Sleepwalker) (added 2003-04-24): Downloads:
This example by "Sleepwalker" shows how to make 360-degrees rotational movement and shooting. Includes instructions.

Random movement example (by Sleepwalker) (added 2003-04-23): Downloads:
An example of random movement of an object. Written by "Sleepwalker".

Laser example 2 (by "Yourself") (added 2003-04-14): Downloads:
Just a little speed improvement of the previous laser example (see below).

Torpedo example (by "Yourself") (added 2003-04-09): Downloads:
An example that shows how you can implement torpedoes that slowly turn towards a target and hit it. Written by "Yourself".

Laser example (by "Yourself") (added 2003-04-09): Downloads:
This example shows how you can use a "laser beam" to shoot objects and detect line collisions. Written by "Yourself".

Dice example (by Charlie) (added 2003-03-24): Downloads:
An example of how to implement a dice roll. Written by Charlie.

Line-Of-Sight example (by Joonas Laakso) (added 2003-03-18): Downloads:
This is an example created by Joonas Laakso. It shows how to implement a line-of-sight algorithm in a grid-based environment.

MessageBox example (by Miss Joan) (added 2003-03-17): Downloads:
This example, by Miss Joan, shows how you can customize the message box in Game Maker. The message box is the one that is used for example in the show_message command.

Decimal to Hexadecimal converter example (added 2003-03-13): Downloads:
After reading a post in the forum, I reckoned there was a need for an example that can be used to convert decimal numbers to hexadecimal numbers. This example includes a very-easy-to-use script that can be used to convert decimal numbers to a string containing the hexadecimal representation of the number.

Particle fireworks example (by Martijn)(added 2003-03-10): Downloads:
An example by Martijn showing a way to make a particle system with fireworks.

Powershot example 2 (added 2003-03-07): Downloads:
Changed the powershot exampel slightly so that the power now determintes the muzzle velocity (wow! Cool word for bullet speed) instead of the bullet size, and the bullet is now affected by gravity and explodes on ground impact.

Powershot example (added 2003-03-04): Downloads:
An example showing how you can make "powershots". That is, the power of the bullet that is shot out is determined by how long you hold the fire button. Includes a little powerbar that shows the current power.

Text file example (added 2003-02-25): Downloads:
I made a little example that shows how to write a string to a text file and read it back.

Split Screen example (by Michael Westwood of MWW Software)(added 2003-02-21): Downloads:
This is a great example by Michael Westwood that shows different setups of split screens for games. At most there are 4 views at the same time, each with a keyboard-controlled object.

Sprite add example (added 2003-02-12): Downloads:
Shows how the sprite_add command can be used to load a new sprite into the game at runtime.

Undo example for Sokoban games (added 2003-02-05): Downloads:
A little example that shows an "undo" function for Sokoban type games.

Missile lock example (by Chuck) (added 2003-01-30): Downloads:
This example by Chuck shows one way to make a missile fire and track an object.

TypeWriter example 3 (added 2003-01-09): Downloads:
Just changed the typewriter example so that it now gets the text from within Game Maker, and not from an external text file.

2-in-1 view example, by Hardi Erstu (added 2002-12-16): Downloads:
An example of two players in one view. Example written by Hardi Erstu.

Simple Snake example (added 2002-11-25): Downloads:
This is an extremely simple snake example. Please note that I created this during a lunch break, so the graphics is REALLY Extremely Much Below Sub-Par. Also, the coding could be very much enhanced, but the basic gameplay is there. :)

360-degrees movement with animating sprite example (added 2002-11-14): Downloads:
This example shows how to make an animated, yet 360-degrees rotationable sprite. It shows a man that walks across the screen (seen from above). He also leaves footprints (very simplified).

Random Landscape example (added 2002-10-18): Downloads:
Phew! Almost a month since my last example... in a bad shape I guess...

Anyway. This example shows how to create a random background (floor and ceiling) in a horizontal scroller game. Thanks to Jared Nicholas for idea.

Custom Characters example (added 2002-09-24): Downloads:
Now I have made an example that shows how you can write text using sprites. Thanks to Fivesquare for the character sprites :).

TypeWriter example 2 (added 2002-09-10): Downloads:
Changed the typewriter example a bit so that it can now be used for Credits. It writes one paragraph of text, pauses and then erases and writes the next.

Color Selector example (added 2002-09-09): Downloads:
Shows how to select and separate a color into red, green and blue components.

Scrollbars example (added 2002-09-06): Downloads:
On a request from the Game Maker Forum, I created an example that shows one way to use scrollbars in a game with a scrolling view.

TypeWriter example (added 2002-09-06): Downloads:
This example shows how text from a text file can be read in and presented in the game as if it was written letter by letter on an typewriter (with sound).

Minigolf example 2 (added 2002-09-06): Downloads:
Just added a putter cursor. But I think it works quite nice. No other changes to the original minigolf example.

Credit example v 3 (added 2002-08-29): Downloads:
An example that shows how you can read in a textfile into Game Maker and use the draw_text command to scroll a credits text across the screen. The program is very well commented. Also pretty easy to customize. The text fades out when there is only half a page of text left on the screen.

Minigolf example (added 2002-08-27): Downloads:
Exampe of a little minigolf game. The thing I have concentrated on is the scoring.

Sprite movement with markers (unfinished motorcycle game) (added 2002-08-23): Downloads:
This is an unfinished game created by Susan Jaye. It is a remake of a game called "Daredevil Denis" for the BBC Micro and Spectrum. The game file shows how you can use invisible markers to control the movement of a player object.

Thanks to Susan for this example.

Level Reader example v 1 (added 2002-08-21): Downloads:
This is an example of how to read in a text file that builds the level of a game. It is very simplistic, but it reads a text file and puts objects in the game according to the text file contents.

Inventory Example v 3 (added 2002-08-14): Downloads:
I have improved the inventory example (version 2) so that now there is a selector, which makes it possibel to select and use an inventory item. Also I added the possibility to add more than 4 items to the inventory. When more items are added, small arrows appear telling that it is possible to scroll the inventory. Now, theoretically, any amount of items can be added. I set the limit to 10, just to have a limit.

Tank and Turret experiment (added 2002-08-09. Small revision 2002-08-16): Downloads:
I made a little experiment with a tank and a turret. The tank moves with the cursor keys, and the turret always points where the mouse cursor is. It can shoot too. :) Just to see how it can be done.

Laps counter example (added 2002-08-09): Downloads:
Here is an example of how to count laps in a racetrack game.

Click-and-drag example (added 2002-08-07): Downloads:
Shows how you can do click-and-drag in Game Maker with multiple, partially overlapping objects.

Dialog example (added 2002-07-31): Downloads:
A little example with a small dialog between the player and a computer character. Press "T" to "talk" to the other man while near him.

Countdown example (added 2002-07-29): Downloads:
An example of how to count down time, displaying time in the format HH:MM.

Change Speed example (added 2002-07-13): Downloads:
A very small example that shows how to change the speed of an object via a global variable and a "switch" in another room.

Registry Edit example (added 2002-05-28): Downloads:
Example that shows how you can use the registry to store small amounts of data, for example a text string.

Textbox for passwords example (added 2002-05-27): Downloads:
Adapted the textbox for use with passwords. Only displays "*" instead of the input text.

Improved Time Pie example (added 2002-04-30) Downloads:
I added a pause function to the time pie example.

Platform example 1 (added 2002-04-25) Downloads:
Example of platform game. Horizontal and vertical moving platforms. Variable jumping heights. Note: The graphics are NOT the point of this example. It is very simple.

Crushed Block example (added 2002-04-22) Downloads:
Example of how you can crush a block in 4 steps with a ball.

Slightly updated Credits example (added 2002-04-19) Downloads:
The credits now move slower, controlled by an object.

Updated Follow Tracks example (added 2002-04-18) Downloads:
Now the dog in the Follow Tracks example changes its sprite depending on in which direction it is going. Made on request.

Timing example (added 2002-04-11) Downloads:
Example of how you can print out minutes, seconds and hundreds. Useful in racing games. Includes "zero-padding".

Test of Room_Start Event (added 2002-04-10) Downloads:
This little text shows a little bug in Game Maker where the Room_Start event does not trigger for a Persistent object in other rooms that the room it is created.

Flip Tiles (added 2002-04-08) Downloads:
An example of how you accomplish the task of flipping the four tiles adjacent to the one that is clicked by the player. Made for "GAPFOREMAN" on the GM Forum.

Custom numbers example (added 2002-04-04) Downloads:
If you want to draw numbers a bit fancier than using the draw_text command, you could use sprites. Here is an example of how.

Textbox example version 2 (added 2002-02-27) Downloads:
Now I have managed to improve the textbox example so that it is possible to use the TAB key to move between the boxes. This is implemented through inheritance. Thanks a lot to Smarty (Martin Rijks) for helping me on this.

Textbox example (added 2002-02-22) Downloads:
This is an example of how you can create a textbox in a game for the user to input some text. Very useful for exclusive mode where Windows dialogs are not possible.
I tried to add the functionality to use the TAB key to move between texboxes, but have not figured out how to manage it in a good and general way yet. These textboxes should be clicked on to move focus to them.

Password example (added 2002-02-12) Downloads:
Simple example of how a password selection and question can be made. I did this very fast and therefore there are not much comments. Sorry about this.

Parallax scrolling example (added 2002-02-06) Downloads:
Example of how you can use parallax scrolling backgrounds with a platform game. This only contains a moving player and 3 background layers. But the principle is the same.

Inventory Example v 2 (added 2002-01-30) Downloads:
Extended the inventory example to include both addition and removal (use) of items. Now it is also possible to add multiple objects of the same kind.

Button Selection Example (added 2002-01-15) Downloads:
Shows one example of how it is possible to select a number of buttons using the up/down keys.

Marquee Example (added 2002-01-14) Downloads:
An example of a number of text strings scrolling from right to left.

Split String Example (added 2002-01-08) Downloads:
An example of a script that splits a string at a given delimiter. Check the script "splitstring".

SaveGame Example (added 2002-01-07) Downloads:
Shows how you can use the save game dialog to enter or select a file and save the game status. Also includes the loading sequence.

3D Solid "Lightshaded" Cube rotating and moving in 3D (added 2001-12-20) Downloads:
Finally found a web page with the vector cross-product calculation on. Here is a 3-dimensional cube. It is solid and "lightshaded". There are two different kinds of light sources avaible for you to test.

3D Wireframe Cube rotating in 3D (added 2001-12-19) Downloads:
Shows a 3D wireframe cube rotating in 3D.

Inventory Bar with 2 views (added 2001-12-14) Downloads:
Modified the inventory bar example so that it now includes 2 views.

Stars Rotating And Moving (added 2001-12-14) Downloads:
This is a combination of the 3D Starfield and the 3D Rotation example - A Starfield that rotates and moves. Looks a bit wierd though...

3D Rotation with Starfield example (added 2001-12-11) Downloads:
I have added rotation to a small starfield. Just to show how it can be done. Rotate it with the cursor keys.

Small Inventory Bar example (added 2001-12-10) Downloads:
This is an evolution from the health bar example. Shows a small inventory bar where found objects are added.

Time Pie example (added 2001-12-10) Downloads:
How to create a "time pie" that fills up as time goes by.

Random Enemy Movement example (added 2001-12-08) Downloads:
Shows a simple algorithm for moving an enemy randomly. Also a simple example of a background starfield. Sort of parallax example too.

3D Starfield example (added 2001-12-04) Downloads:
A small example of a 3-dimensional starfield that you travel through. Only 150 stars, and already starting to go slow. This most probably proves that 3D-games are NOT possible in Game Maker.

Health Bar example (added 2001-12-03) Downloads:
An example of how you can add a healthbar to a scrolling game, and the bar stays in the same place on the screen all the time. Also displays a small version of the health bar close to the player all the time, like in an RTS game.

Doors and Keys example (added 2001-11-27) Downloads:
I made this just to show an example of how you can create an RPG with keys and doors, using the Persistence of a room and global variables.

Grappling Hook example (added 2001-11-21) (updated 2001-11-26) Downloads:
Shows how to make a worms style grappling hook. A bit more advanced. Includes some trigonometry ;)

Tracks Following example (added 2001-11-22) Downloads:
An example of how to make an object follow another object, in its tracks.

Worm Reticle example (added 2001-11-21) Downloads:
How to create a worms style reticle (aka Haircross). Not so advanced, but trigonometry is needed here too.

Credits example (added 2001-11-20) Downloads:
This is en example of how you can add a credits scroll to your game. Very simple, really.

TextTest (Press 'T' to draw sprite...) Downloads:
This example took 5 minutes to create, just to show how to test keyboard presses.

carl.gustafsson@gmail.com

[HEM] [HOME]
last updated: 2003-10-09