Summary of "GameMaker Studio 2: Complete Platformer Tutorial (Part 1: Basics)"
GameMaker Studio 2: Complete Platformer Tutorial (Part 1: Basics) - Summary
This tutorial covers the foundational steps to create a simple platformer game in GameMaker Studio 2, aimed at beginner developers. The instructor guides viewers from starting a blank project to having a basic player character that can move left and right, collide with walls, fall due to gravity, and jump.
Storyline / Goal:
- Build a complete platform game from scratch.
- Progress from simple colored squares to a functional platformer with smooth movement, collision, gravity, and jumping mechanics.
- Later parts will include menus, screen shake, flourishes, and more advanced features.
Gameplay Highlights:
- Player represented by a green square sprite.
- Walls represented by gray rectangles.
- Player can move left and right.
- Player collides properly with walls.
- Gravity pulls the player down.
- Player can jump when on the floor.
Step-by-Step Guide & Key Tips:
1. Setting up Sprites:
- Create two sprites: one for the player (
s_player) and one for the wall (s_wall). - Use 32x32 pixel size (default can be 64x64 but can be changed in preferences).
- Fill player sprite green, wall sprite gray.
- Set the origin point of sprites to the middle center (16x16) for consistent positioning.
2. Creating Objects:
- Create two objects:
o_playerando_wall. - Assign the corresponding sprites to each object.
- Objects hold the game logic.
3. Designing the Room:
- Use the default room (
room0). - Place player and wall objects in the room.
- Walls form the level boundaries and platforms.
- Use the instance layer to place objects.
- Drag and drop with ALT key to place multiple instances.
4. Basic Movement Logic:
- Add a Create Event in
o_playerto initialize variables:HSP(Horizontal Speed) = 0VSP(Vertical Speed) = 0GRV(Gravity) = 0.1 (later increased to 0.3)WALK_SP(Walk Speed) = 4
- Variables store speeds and gravity values.
5. Input Handling (Step Event):
- Use the Step Event (runs every frame, ~60 FPS):
- Check keyboard inputs for left, right, and jump keys.
- Use
keyboard_check()for continuous key hold detection. - Use
keyboard_check_pressed()for detecting jump key press on the current frame only.
- Calculate movement direction:
move = key_right - key_left(results in 1, 0, or -1)- Set horizontal speed:
HSP = move * WALK_SP
- Update player’s
xposition:x += HSP
6. Collision Detection and Response:
- Use
place_meeting()to predict collisions before moving. - For horizontal movement:
- If collision detected at
x + HSP, setHSP = 0. - Use a
whileloop to move the player pixel by pixel closer to the wall until just touching it.
- If collision detected at
- For vertical movement:
- Similar logic applied using
VSPandycoordinate.
- Similar logic applied using
- This ensures smooth, pixel-perfect collision handling.
7. Gravity and Vertical Movement:
- Increment vertical speed by gravity each frame:
VSP += GRV - Update vertical position:
y += VSP - Player falls naturally and lands on platforms.
8. Jumping:
- Check if player is standing on the floor using
place_meeting(x, y + 1, o_wall) - If on floor and jump key pressed, set
VSP = -7to move upwards. - Gravity will pull the player back down after the jump.
Additional Tips:
- Use comments (
//) to label sections of code for clarity. - Use semicolons to end lines of code (good practice).
- Variables declared with
varinside the step event are temporary and last only for that frame. - The tutorial encourages rewatching and checking the GameMaker manual for functions used.
- The game runs best at 60 FPS for smooth movement.
Outcome:
By the end of this part, you have a working player character that moves left and right, collides correctly with walls, falls due to gravity, and can jump—forming the core mechanics of a platformer.
Featured Gamer / Source:
- Tutorial by Shaun Spalding, a well-known GameMaker educator.
- Shoutout to Patreon supporters: Dan Angel Rodriguez, Harold Gidry, Jason McMillan.
Category
Gaming
Share this summary
Is the summary off?
If you think the summary is inaccurate, you can reprocess it with the latest model.
Preparing reprocess...