Project Name
Your GameMaker project must be named:
PX_lastname_SimplePlatformer
Replace lastname with your own last name.
Example:
PX_Smith_SimplePlatformer
Learning Objectives
By the end of this lesson, you should be able to:
- Create a GameMaker project.
- Create player and platform sprites.
- Create objects and a game room.
- Program horizontal player movement.
- Implement gravity and jumping.
- Detect collisions with platforms.
- Prevent the player from falling through platforms.
- Prevent repeated jumping while airborne.
- Create a playable platform course.
- Create a goal and level completion condition.
- Test and debug your program.
- Capture a screenshot and gameplay video.
The Goal
You will create a 2D platform game using the GameMaker game engine and GameMaker Language (GML).
Your player will move left and right, jump onto platforms, and fall due to gravity.
The player must successfully jump between platforms to reach the final goal.
Your completed game must demonstrate gravity, jumping, platform collisions, and level completion.
Required Submission Files
| File | Description |
|---|---|
| PX_lastname_SimplePlatformer | Complete GameMaker project. |
| PX_lastname_SimplePlatformer_Screenshot.png | Screenshot showing your completed project inside the GameMaker engine. |
| PX_lastname_SimplePlatformer_Demo.mp4 | Video showing your actual game running. The recording must be at least 7 seconds long. |
Part 1 – Create the Project
- Open GameMaker.
- Create a new project.
- Select a GML Code project.
- Save the project using the required filename.
PX_lastname_SimplePlatformer
Show your teacher that your project has been created and named correctly.
Part 2 – Create the Sprites
Create the following sprites:
| Sprite | Suggested Size | Purpose |
|---|---|---|
| spr_player | 32 × 32 | Player character |
| spr_platform | 64 × 32 | Ground and elevated platforms |
| spr_goal | 32 × 32 | Final destination |
You may draw your own graphics or use simple colored rectangles.
Sprite Origins
Set the origin of the player and platform sprites to Top Left (0, 0).
Use rectangular collision masks for the player and platforms.
Part 3 – Create the Objects
| Object | Sprite |
|---|---|
| obj_player | spr_player |
| obj_platform | spr_platform |
| obj_goal | spr_goal |
Assign the appropriate sprite to each object.
Leave the objects' Solid property unchecked. You will handle collisions using GML code.
Part 4 – Create the Room
Create a room called:
rm_game
Suggested room dimensions:
- Width: 1024 pixels
- Height: 768 pixels
Place one player near the bottom-left corner.
Create a starting ground platform and several elevated platforms.
Place the goal on the final platform.
Example Level Design
This illustration is an example of how to arrange your platforms. Your actual room must be created inside GameMaker.
Show your teacher the player, ground, elevated platforms, and goal in the Room Editor.
Part 5 – Create Player Movement Variables
Select:
obj_player
Add a Create Event.
Enter:
// Player movement settings
move_speed = 4;
// Vertical movement settings
vsp = 0;
// Gravity acceleration
gravity_force = 0.5;
// Initial upward jumping velocity
jump_speed = -10;
// Maximum falling velocity
max_fall_speed = 12;
Understanding the Variables
| Variable | Purpose |
|---|---|
| move_speed | Horizontal player movement speed |
| vsp | Current vertical velocity |
| gravity_force | Downward acceleration |
| jump_speed | Initial upward jumping velocity |
| max_fall_speed | Maximum falling speed |
Part 6 – Program Horizontal Movement
Add a Step Event
to obj_player.
Enter the following code:
// Check keyboard input
var move_right = keyboard_check(vk_right)
|| keyboard_check(ord("D"));
var move_left = keyboard_check(vk_left)
|| keyboard_check(ord("A"));
// Determine horizontal movement
var hsp = (move_right - move_left) * move_speed;
// Move without passing through platforms
var remaining_x = abs(hsp);
var step_x = sign(hsp);
while (remaining_x > 0)
{
var amount = min(1, remaining_x);
if (!place_meeting(
x + step_x * amount,
y,
obj_platform))
{
x += step_x * amount;
}
else
{
break;
}
remaining_x -= amount;
}
// Keep the player inside the room
x = clamp(
x,
0,
room_width - sprite_width
);
Understanding the Code
keyboard_check() detects whether
the player is pressing a movement key.
hsp stores the player's horizontal
movement for the current step.
place_meeting() checks whether moving
the player would cause a collision with a platform.
clamp() prevents the player
from leaving the room horizontally.
Run your program and demonstrate that the player moves left and right.
Part 7 – Add Gravity and Jumping
Understanding Gravity
Gravity pulls the player downward.
In GameMaker, positive vertical velocity moves the player downward.
Negative vertical velocity moves the player upward.
// Upward movement
vsp = -10;
// Downward movement
vsp = 10;
Add the Jumping Code
Add the following code underneath the
horizontal movement code in the
obj_player Step Event.
// Check whether the player is on a platform
var on_ground = place_meeting(
x,
y + 1,
obj_platform
);
// Allow jumping only while standing
// on a platform
if (on_ground && (
keyboard_check_pressed(vk_space)
|| keyboard_check_pressed(vk_up)
|| keyboard_check_pressed(ord("W"))
))
{
vsp = jump_speed;
}
// Apply gravity
vsp += gravity_force;
// Limit falling speed
vsp = min(vsp, max_fall_speed);
How Jumping Works
- The player presses Space, W, or Up.
- The game checks whether the player is on a platform.
- The player's vertical velocity becomes negative.
- The player moves upward.
- Gravity gradually reduces upward velocity.
- The player stops rising and begins falling.
- The player lands on a platform.
Demonstrate that your player jumps and that gravity causes the player to fall back toward the ground.
Part 8 – Add Vertical Collision Detection
The player must land on platforms instead of falling through them.
Add the following code underneath your
gravity and jumping code in the
obj_player Step Event.
// Move vertically without passing
// through platforms
var remaining_y = abs(vsp);
var step_y = sign(vsp);
while (remaining_y > 0)
{
var amount = min(1, remaining_y);
if (!place_meeting(
x,
y + step_y * amount,
obj_platform))
{
y += step_y * amount;
}
else
{
// Stop vertical movement
// when a platform is reached
vsp = 0;
break;
}
remaining_y -= amount;
}
Understanding Collision Detection
The code checks whether the player's next movement would cause a collision.
If the path is clear, the player moves.
If a platform blocks the movement, the player stops.
This prevents the player from falling through platforms or jumping through platforms from below.
Demonstrate that the player can:
- Jump onto a platform.
- Land on the platform.
- Jump again after landing.
- Stop when hitting a platform from below.
- Stop when moving into the side of a platform.
Part 9 – Create a Playable Platform Course
Your game must contain at least five platforms, including the starting ground.
Arrange platforms at different heights.
The player must move horizontally and jump to reach the final platform.
Required Features
- Starting ground platform.
- At least four additional platforms.
- Platforms at different heights.
- Platforms separated by gaps.
- A playable path from start to finish.
Test every jump to make sure the player can complete the course.
If a jump is too difficult, adjust the platform positions or jumping variables.
Part 10 – Create a Goal
Create a sprite called:
spr_goal
Create an object called:
obj_goal
Assign spr_goal
to obj_goal.
Place the goal on the final platform.
Goal Collision
Select obj_player.
Add a Collision Event with
obj_goal.
// Complete the level
show_message(
"Congratulations! You completed the level!"
);
// Restart the room
room_restart();
When the player reaches the goal, a completion message appears and the room restarts.
Part 11 – Test Your Game
Run the game and check each requirement.
Part 12 – Required Screenshot
PX_lastname_SimplePlatformer_Screenshot.png
You must submit a screenshot of your completed project inside the GameMaker engine.
Instructions
- Open your completed project in GameMaker.
- Display the Room Editor showing your completed platformer level.
- Make sure the player, platforms, and goal are visible.
- Press Windows + Shift + S to open the Windows Snipping Tool.
- Capture the GameMaker window.
- Save the screenshot as a PNG file.
Your screenshot should show the GameMaker interface and your completed project.
A drawing of the game or an image taken from the internet does not satisfy this requirement.
The screenshot must come from your actual GameMaker project.
Part 13 – Required Gameplay Video
PX_lastname_SimplePlatformer_Demo.mp4
You must record a video demonstrating your actual GameMaker program running.
Minimum Video Length: 7 Seconds
The video must show the player moving, jumping, and interacting with platforms.
Recording Instructions
- Open your completed project in GameMaker.
- Run the game.
- Open Windows Snipping Tool and select its video recording option, or use another screen recorder.
- Select the area containing the running game.
- Begin recording.
- Demonstrate the required gameplay.
- Stop the recording after at least 7 seconds.
- Save the recording as an MP4 file.
What Your Video Must Show
- Player movement to the left and right.
- The player jumping.
- The player landing on a platform.
- The player jumping between platforms.
- The game running without error messages.
Reaching the final goal during your recording is encouraged.
The recording must show your actual completed game running.
A slideshow, animation, or unrelated game video does not satisfy this requirement.
Part 14 – Debugging Checklist
Player Does Not Move
Check the player's Step Event.
Make sure the movement code is
inside obj_player.
Player Does Not Jump
Check that jump_speed
is a negative value.
Make sure the player is standing on a platform before pressing Jump.
Player Falls Through Platforms
Check the collision masks and vertical collision code.
Verify that the platform object
is named obj_platform.
Player Can Jump Repeatedly in Midair
Make sure the jump code checks whether the player is standing on a platform.
Player Cannot Reach a Platform
Adjust platform positions or the jumping variables.
Goal Does Not Work
Check the Collision Event between
obj_player
and obj_goal.
Part 15 – Optional Challenge Activities
Challenge 1 – Add Coins
Create collectible coins that increase the player's score.
Challenge 2 – Moving Platforms
Add platforms that move horizontally.
Make the player move with a platform while standing on it.
Challenge 3 – Add Enemies
Create enemies that move along platforms.
The player must avoid touching them.
Challenge 4 – Double Jump
Allow the player to perform one additional jump while airborne.
Challenge 5 – Multiple Levels
Create a second room with a more difficult platform arrangement.
Challenge 6 – Player Animation
Add different animations for:
- Standing
- Running
- Jumping
- Falling
Challenge 7 – Sound Effects
Add sounds for:
- Jumping
- Landing
- Collecting coins
- Reaching the goal
Vocabulary
| Term | Definition |
|---|---|
| Sprite | The graphic representing an object. |
| Object | A GameMaker resource containing behavior. |
| Instance | A specific copy of an object in the game. |
| Gravity | Acceleration that pulls the player downward. |
| Velocity | Speed and direction of movement. |
| Jump Speed | Initial upward velocity given to the player. |
| Platform | A surface that the player can stand on. |
| Collision Detection | Determining whether objects are touching or overlapping. |
| place_meeting() | Checks whether an instance would collide with an object at a position. |
| keyboard_check() | Checks whether a key is currently held down. |
| keyboard_check_pressed() | Checks whether a key was pressed during the current step. |
| Step Event | An event that runs repeatedly while the game is active. |
| clamp() | Restricts a value to a specified range. |
Review Questions
- What is gravity, and how does it affect the player?
- Why does jumping velocity begin with a negative value?
- What happens to vertical velocity while the player is falling?
-
How does
place_meeting()prevent the player from moving through platforms? - Why should jumping be allowed only when the player is standing on a platform?
- What is the difference between horizontal and vertical velocity?
- How could you make the player jump higher?
- What happens if the gravity value is increased?
- Why is collision detection important in a platform game?
- What must your gameplay video demonstrate to show that your program works?
100-Point Grading Rubric
| Requirement | Points |
|---|---|
| Correct project filename | 5 |
| Player and platform sprites and objects | 10 |
| Room design with at least five platforms | 10 |
| Left and right player movement | 10 |
| Gravity and falling behavior | 10 |
| Jumping and grounded-jump restriction | 10 |
| Horizontal and vertical collision detection | 15 |
| Goal area and level completion | 5 |
| Game runs without errors | 5 |
| Screenshot of the completed project inside GameMaker | 10 |
| Gameplay video of at least 7 seconds | 10 |
| TOTAL | 100 |
Final Teacher Checkpoint
Before submitting your assignment, demonstrate your completed game to your teacher.
Your teacher should see:
- Player movement.
- Jumping.
- Gravity.
- Landing on platforms.
- Collision detection.
- Level completion.
Final Submission
Submit all three required items to Google Classroom according to your teacher's instructions.
Verify that all files use your correct last name before submitting.
Final Goal
Create a working Simple Platformer that demonstrates: