Day 3: A Lesson in Persistence
It was a productive day on the maze game project, and I managed to work through three of Mr. Ridgway's tutorials. The game is starting to feel much more like a real challenge now, with a score tracker, enemies, and a respawn system that sends the player back to the start after a collision. I also took a moment to add some personal touches, replacing the placeholder sprite with our rubber duck mascot and creating a swirling animation for the level-ending portal to mimic a bathtub drain.
The most valuable part of today's session, however, came from going a little off-script. I ran into a puzzle with the score variable; it kept resetting whenever the player moved to the next level. He had created a global.score variable in the Create event but was changing the score with a score variable (not global.score). I noticed his score was carrying over to the next level, but mine was resetting. I tried putting score in the variable definitions and it didn't work either. It didn't make sense to me why his worked... It didn't make sense that his instance variable was transferring to the next level when it was a new instance of the obj_player.
This led me down a fantastic rabbit hole of discovery about how GameMaker handles objects between rooms. It turns out that if an object instance isn't explicitly destroyed when you change rooms, the values saved in its instance variables can persist, meaning their values carry over to a new level like a global variable. Whether this is intentional or just a quirk of the engine, I didn't like it. It felt too much like magic and was unintuitive. To make the logic more clear for myself and for better long-term practice, I refactored the code to initialize the score as a global variable in a "Game Start" event. It's a small change, but it makes the code's intent much more readable and robust.
That little success inspired me to go further off-script even a little more. I went ahead and created two types of enemies, one that moves vertically and one that moves horizontally. I even added my own code using image_angle
to make them visually change direction when they bounce off a wall, a little touch of polish the tutorial didn't include.
I'm very pleased with the results. It's moments like these—when you have to stop, investigate a problem, and build your own solution—that make you feel like you're truly learning, not just following along.
Bootcamp #2: Maze Game
Simple maze game created from a tutorial to learn a different movement system and gameplay loop
Status | In development |
Author | corkboardstudio |
Genre | Action |
Tags | Arcade, GameMaker, maze |
More posts
- Day 4: Pushing Through the Exhaustion2 days ago
- Day 2: A different way to handle collisions in GameMaker9 days ago
- Day 1: Starting the Second Bootcamp Project11 days ago
Leave a comment
Log in with itch.io to leave a comment.