Gamemaker Academy
Spring 2004

Week 1: Let's Make A Game
In week 1 we'll look at a few games and make our own "breakout" game. We'll also talk about all the things that go into a game and you'll be ready to design your own game! Your assignment will be to bring a game idea to the next class.

Week 2: What's In A Game?
In week 2 you'll present your game ideas to the group and we'll discuss what makes a good game. Then we'll spend some hands-on time examining all of the things the Gamemaker tool can do for you. You'll start writing your game this week! Your assignment will be to "detail" your game idea. If your game idea was "a frog hops across a road and tries to not get hit by a truck", your detail may include how many trucks go by and how fast and how wide the road is and how scoring will work and how many lives you get and what the next level will look like and...

Week 3: Putting It All Together
We'll review Gamemaker and all the things that make a game: objects, events, properties, sprites, rooms, and so on, and by the start of week 3 you'll know what all those things mean! We'll talk about what to do when things go wrong, but mostly you'll be building your game! Now that you've seen what the real world of Gamemaker is like, your assignment will be to revise the detail you came in with. You may decide that you want trucks to come from both directions, and there should be a manhole to fall down and having a pickup truck try to run down the frog is Just Too Hard!

Week 4: Peer Review
By this time you'll know what you can and can't do, and what's easy and what's just way too tricky. You'll each discuss your detail in, um, detail with the group. We'll exchange ideas and maybe I'll give up a secret or two to make your game writing a bit easier.

Week 5: A Good Start...
After a quick review of events and actions, you'll spend the rest of the class creating your game. Questions are answered, and answers are questioned.

Week 6: ...Making Progress...
You'll learn some of the cooler Gamemaker tricks and get back to building your game.

Week 7: ...And We're Done!
A few more tricks and it's back to building. How do you know when you're done? The class ends and I take your games away (until next week).

Week 8: Take a Bow
You each get a CD with your personally registered copy of Gamemaker and all of the games the class produced. We'll share the games and see what you've created.

Need help? Send an e-mail to me at games@c-ease.com

Glossary
actionHow the game responds to an event.
alarmAn action that causes an alarm event to occur a specific number of steps in the future.
animationA gif image may contain several individual images that are displayed in sequence to produce an animation. An Animation End event is fired at the end of the animation sequence.
backgroundthe image(s) that underlay the objects in a room. They are static, i. e. they cannot collide with or block objects. Several backgrounds may be laid on top of each other, and a background can be declared as "foreground" to allow it to be displayed over objects (e. g., clouds obscuring aircraft objects).
eventa way of informing objects that something has happened.
expressiona mathematical formula that describes an aspect of an action. For instance, to make an object jump a bit to the right of the mouse position, you might set the x position to mouse_x + 4. An expression returns a value.
functiona (usually) complex expression hidden in a single operation. Functions are called by name and an argument, such as string_length("abcde") to return the length of the string "abcde". The most common function is random(arg) which returns a number from zero up to (but not including) "arg". Functions can be used in expressions. For example, random(6) + 1 would simulate a die roll (return a number from 1 to 6).
gifA common image format. Gifs can be animated.
instancean object, as it appears in the game. There may be multiple instances of a single object. In general, all exhibit the same behavior (that is, they look the same and respond with the same actions to the same events).
key pressAn event that occurs when a key is pressed, but not repeated when the key is down (as a keyboard event is).
key releaseAn event that occurs when a key is released, but not repeated when the key is down. For instance, in a pinball game the plunger may jump to its start position at key press, move back during the keyboard event, and shoot forward when key release is detected.
midiA very efficient format for storing music. Generally used for background music.
objecta template for instances. Objects define the events and actions of the instances, which actually appear in the game.
persistencehow long something lasts. For objects, it determines whether it will exists from room to room. For a room, it defines whether the room will look the same when a user returns to it.
propertyA variable that is part of an instance. For example x refers to the current horizontal location of an instance.
resourceAnything in the game: backgrounds, objects, sprites, sounds, tiles, etc.
roomThe screen upon which objects are placed.
scriptA block of code that you can write as an action
spriteWhat you see when you look at an instance in a room.
stepThe basic unit of "time" which guides the game. Normally, a step is equal to 1/30 of a second, but that can be changed.
tileSmall bits of background that can be used to build up a complex room.
variableA way to save information to use later. Generally used in scripts; most game writers will use object properties instead.
viewA way to display only a portion of a room at a time.
wavAn uncompressed sound generally used to provide short sound effects during a game ("boing" for a bounce, or a short tune when a character dies).

 

Events
NameFiredTypical Action
Createwhen an instance is createdstart moving
Destroyjust before the instance is destroyedplay a sound; create a new instance elsewhere
Alarmwhen the alarm "time" becomes zerocreate a new instance
Step Startat the very start of the stepcancel an alarm before it's triggered
Stepin the middle, just before instances are movedtest a variable
Step Endnear the end, before redrawing the roomsnap to grid before displaying
Collisionwhen two instances touchbounce
Keyboardwhen a key is downincrease speed
Key Presswhen a key is first pressedstart movement
Key Releasewhen a key is releasedstop movement
Mouse downwhen the specified button is pressed and the mouse is over that instance.increase score
Mouse Presswhen the specified button is first pressed and the mouse is over that instance.play a sound
Mouse Releasewhen the specified button is released and the mouse is over that instance.move the instance
Global Mouse PressWhen any button is pressed and the mouse is anywhere over the game.move toward the mouse pointer
Global Mouse ReleaseWhen any button is released and the mouse is anywhere over the game. 
Joystick directionWhen the joystick is pointing in any of the four primary directions (two events will occur if the joystick is at a diagonal) 
Joystick buttonWhen the specified button is down 
Outsidewhen the instance is completely outside the room destroy the instance
Boundarywhen the instance touches the boundarybounce
Game Startwhen the game beginsstart music
Game Endwhen the game endsshow hi-score table
Room Startwhen the room is first displayedstart alarms
Room Endwhen the room is exitedpause and play music
No More Liveswhen the lives property is set to zero end game, show hi score table, play music
No More Healthwhen the health property is set to zero reduce number of lives, reset health
End of Animationwhen the current sprite animation ends destroy instance
End Pathwhen the path the instance is following ends restart path
User Definedwhen an action is to fire a user-defined event 
Drawwhen the instance is being drawndraw sprite image based on direction of movement
Actions
ActionDoes
Start Moving In A Directionchoose one or more of eight directions and a speed to move at. Selecting more than one will cause a random choice.
Set Direction & Speedchoose a precise direction (degrees) and speed
Set Horizontal Speedset the horizontal speed
Set Vertical Speedset the vertical speed
Move Toward a Pointspecify a point (x and y) and speed and move toward it at that speed. For instance, to move toward the mouse, set x to mouse_x and y to mouse_y
Set a Pathselect a path resource for this object
Set Gravityset a force that "pulls" the object toward a gravity point. Usually, the angle is 270 ("down")
Set Frictionset a force that slows down the object
Jump to a given positionspecify a point (x and y) to move the object to.
Jump to the start positionmove the instance to its "create" position
Jump to a random positionmove the instance to some non-collision position in the room
Snap to a gridEnsure the object is on a grid position
Reverse HorizontalReverse horizontal direction and speed
Reverse verticalReverse vertical direction and speed
Move to contact positionMove in the direction specified until a collision would occur
BounceChange direction as if the instance "bounced" off the instance it collided with
CreateCreate a specified object instance at a specified location
ChangeChange the specified object into another object type
DestroyDestroy the specified object.
Destroy atDestroy any objects at a specified (x and y) position.
Change spriteUse a different sprite to display for this object
Play soundstart a specified sound resource
Stop soundstop a specified sound resource
if sound is playingtest to see if the sound resource is playing
Goto previous roomEnd this room and start the previous room
Goto next roomEnd this room and start the next room
Restart roomRestart this room.
Goto different roomEnd this room and go to a specified room
If previous room existsTest to see if the previous room exists
If next room existsTest to see if the next room exists. It is important to use this before going to the next room, unless you are certain there are more rooms.
Set alarmSet a specified alarm to trigger after a specified number of steps. If you want your alarm to be regular, you must put this in the alarm event
SleepFreeze the game for a specified time
Set timelineSpecify a timeline for this instance to follow
Set timeline positionSpecify a position on the timeline
Display a messageDisplay a message box for the player
Show game informationShow the "about" information you create
Restart gameEnd the current game and start over
End gameEnd the current game
Save gameSave the current game state
Load gameLoad the game state
If a collisionExecute the next statement if there is a collision at a specified location
If no collisionExecute the next statement if there is no collision at a specified location
If object is at a positionExecute the next statement if there is an instance of a specific object at a location
If number of instances isExecute the next statement if the number of instances of an object equal to, smaller than, or larger than a specified value
If dice is 1Execute the next statement if a random number in the range you specify is "1". For instance, specify 2 to get a coin toss, or 6 for a die.
If the user answers yesDisplay a message and execute the next statement if the user answers yes
If an expression is trueExecute the next statement if the specified expression returns true
If a mouse button is pressedExecute the next statement if the specified mouse button is pressed. The mouse can be anywhere within the game.
If aligned with a gridExecute the next statement if the instance is aligned with the grid.
ElseExecute the next statement if the previous "if" section was not executed. For instance, [if the dice returns 1] move to start [else] destroy self would move to start if the random number was 1, otherwise the object would self-destruct.
Start blockUse to execute more than one statement after an "if" or "else". Each start block must have an end block
End blockEnd the block of statements.
Repeat next actionPerform the next action (or block) a specified number of times
Exit eventStop executing actions for this event
Draw spriteDraw a specified sprite
Draw backgroundDraw a background resource at a specified location. You can specify if it is to be tiled.
Draw rectangleDraw a rectangle. Specify the size and location.
Draw ellipseDraw an ellipse (or circle). Give the size and location.
Draw a lineDraw a line. Give the start and end.
Draw textDraw text at a given location.
Set colorChange the color of whatever is drawn next.
Set fontChange the font for the subsequent text.
Fullscreen modeChange to full screen (arcade) mode. The windows taskbar and borders will disappear.
Set scoreChange the score
If score isExecute the next statement if the score has a specified value
Draw scoreDisplay the score in the room.
Clear highscoreClear the high score table
Show highscoreDisplay the high score table
Set # livesChange the number of lives
If # lives isExecute the next statement if the number of lives has a specified value
Draw # livesDisplay the number of lives in the room.
Draw # lives as imageDisplay a number of icons representing the number of lives.
Set healthChange the health value
If health isExecute the next statement if health has a certain value
Draw health barDisplay the health bar in the room
Set caption informationDisplay lives/score/health in the title bar
Run scriptExecute a script (short code segment)
Run codeExecute a longer code segment
Set variableChange a property for an object or instance.
If variableExecute the next statement if the property has a specified value
Draw variableDisplay the value of the variable in the room
Call inherited eventIf the object has a parent, execute the parent's event actions
CommentInformation to yourself
Common Properties
PropertyMeaningExample
xHorizontal position of instance. Left is 0 These all work together. If you create an instance at x=(room_width / 2) and y=(room_height / 2) it will appear in the middle of the room. Setting its vspeed=-2 and hspeed=2 means it will travel up and to the right. This is the same as setting the direction=45 (degree angle) and speed=2.83 (trust me).
yvertical position of instance. Top is 0
hspeedhorizontal speed of instance. Right is positive
vspeedvertical speed of instance. Down is positive
directiondirection instance is moving (0=right, 90=up, etc)
speedvector speed instance is moving at
visiblevisible status of the instanceTo magically transport your instance, set visible=false (or 0) and change its position. Set an alarm for, say, 5 steps and when the alarm fires make it visible. It will reappear at its new location at that time. Keep in mind that collisions can occur even when invisible.
image_singleshow a single image from an animated spriteMake a sprite that has images of your character facing left, right, up, and down. Use image_single to choose the appropriate one, based on direction.
scorecurrent value of scoreLet's apply these together. Use a series of "if expression"s: if score mod 10 = 0 then health=health + 10. if health > 100 then lives = lives + 1. If lives > 5 then destroy all monsters.
What that will do is eventually reward the player's skill. Here's the English: Every 10 points (mod 10 means "get the remainder when divided by 10"), add 10 health points. When health gets above 100, give the player an extra life. When the player gets six or more lives, destroy all of the monsters.
These statements aren't perfect. For instance, you'll get an extra health when the score is 0, so it should only be placed after a statement that raises the score. Also, since the health stays above 100, every time this is executed you'll get an extra life. There needs to be a way to prevent that.
livescurrent value of lives
healthcurrent value of health
mouse_xhorizontal position of the mouse This can be used to create your own mouse pointer! In the draw event of any object, draw a sprite that represents the mouse at mouse_x and mouse_y
mouse_yvertical position of the mouse
xpreviousThe x position at the previous step If an instance moves to a "back" button, set the x and y to xprevious and yprevious. This would work whether the object stepped onto the button or "jumped" there.
ypreviousThe y position at the previous step
xstartThe x position at the start of this room When a life is lost, set the instance's x and y to xstart and ystart to begin again without restarting the entire room. Pac-man uses this so the objects that were eaten remain eaten.
ystartThe y position at the start of this room
show_cursorset to true to display the cursor; false to hide it If the mouse is unused, set variable show_cursor to false
background_colorchange the background colorusing "set variable" to set backgdound_color to make_color(score, health, lives) will cause the background color to change as each of those three properties changes. At the start of the game, the background will be quite green. As health and lives go down and the score rises, the color will change to red.
room_widththe width of the roomTo place an object in the center of the room set x = room_width / 2 and y = room_height / 2
room_heightthe height of the room
Common Functions
NameFunctionExample
random(arg)return a random number from 0 up to (less than) arg to move in a random direction, specify random(360). To move at a speed between 2 and 5, set speed to random(3) + 2 (the result will be anywhere from 2 up to 4.999999999)
round(arg)return arg, rounded to an integer All of these return an integer value when you need it. You may want to get adjust the player's score based on his remaining energy level at the end of a room. If the energy can be a real number from 0.000 to 9.999 you can be honest and use round(energy), you can be stingy and use floor(energy) or you can be generous and use ceil(energy).
floor(arg)return arg, rounded down to an integer
ceil(arg)return arg, rounded up to an integer
min(arg1, arg2)return the smaller of arg1 and arg2 To double the current score, but not add more than 10 points use score = score + min(score, 10). To double the current score, but add at least 10 points use score = score + max(score, 10).
max(arg1, arg2)return the larger of arg1 and arg2
point_distance(x1, y1, x2, y2)return the distance from point x1, y1 to point x2, y2An exploding bomb may want to destroy an object if it is within 50 units of the bomb. You could test this with an "if expression" point_distance(x, y, enemy.x, enemy.y) < 50. Or you may want to move to the top left corner of the screen with direction = point_direction(x, y, 0, 0).
point_direction(x1, y1, x2, y2)return the direction from point x1, y1 to point x2, y2
real(str)change a string to a real numberWhen creating your own variables, you often will want to "stick them together" or add them, depending on their use. If you have two strings string1 = "10" and string2 = "5" and you display string1 + string2 you will see "105". If you have two numbers num1 = 10 and num2 = 5 and you display num1 + num2 you will see 15. You can change numbers to strings and back again with these functions.
string(val)change a real number to a string
string_length(str)get the length of the string If the player entered his name and there is only room to display five characters you can use an "if expression" to shorten it: if string_length(name) > 5 then string = string_copy(name, 0, 5).
string_copy(str, index, count)get a partial string. Returns count characters of str starting from index
instance_nearest(x, y, obj)tells you which instance of type obj is closest to position x, y.The zapper at x, y destroys the closest object to it: inst = instance_nearest(x, y, all); inst.instance_destroy(). There are three new things here: the first function returns the identity of that particular instance that's closest. Statements are separated by semi-colons. putting an instance or object type name followed by a dot followed by a function or property means "apply the function to that instance" or "use the property of that instance". So if I'm a paddle and I set x = x + 10, I move 10 pixels to the right. If I set x = ball.x + 10 I move 10 pixels to the right of the ball.
set_cursor(cur)display the cursor as a specific windows cursor. cur can be cr_default, cr_none, cr_arrrow, cr_cross, cr_beam, cr_size_nesw, cr_size_ns, cr_size_nwse, cr_size_we, cr_uparrow, cr_hourglass, cr_drag, cr_nodrop, cr_hsplit, cr_vsplit, cr_multidrag, cr_sqlwait, cr_no, cr_appstart, cr_help, cr_handpoint, cr_size_allUse script to call set_cursor(cr_hourglass) and the mouse pointer will turn into the hourglass shape.

Contact: games@c-ease.com