Day 4: UI & Colorful Asteroids
Another day, another couple of pins firmly placed on the board! Today's session in the Asteroids bootcamp was all about bringing the core elements of the game to life: building a dynamic user interface and populating our empty space with some classic, chunky asteroids.
As you can see in the GIF, the game is starting to look much more like a real arcade shooter!
The User Interface
Following along with Justin Zendt's tutorial, the first step today was building out the UI. The HUD now shows the active weapon and the ship's energy level. Justin implemented a smart energy system that I really like: it refills slowly while you're firing but regenerates much faster if you pause briefly. This creates a fun, tactical incentive for the player to not just hold down the fire button. It's these small, thoughtful design touches in his tutorial that I'm finding so valuable.
To ensure stability, I built the UI into a dedicated "game manager" object. This is a great professional practice that prevents the game from crashing if the UI were attached to a player object that gets destroyed. In addition to the game manager object, Justin also introduced a nice quality of life feature I can use while testing out the game. Pressing the 'R' key resets the game which means I don't have to exit the game now in order to restart.
The Asteroids
Next up was creating the asteroids themselves. For now, they are purely visual, with collision detection on the docket for tomorrow's session.
I made a deliberate choice to go with colorful, stylized asteroids rather than realistic ones. When your spaceship is being piloted by a rubber duck, realism isn't exactly the primary goal!
The key technical lesson here was using parent objects. I created a single parent obj_parent_asteroid
with all the core asteroid logic, and then created "child" objects for the large and small asteroids that inherit that functionality. This is a powerful programming concept that makes it incredibly easy to create variations of an enemy while keeping the core code clean and centralized.
Conclusion: Building a Library
I'm very pleased with the progress. I'm taking my time with each lesson and, as you can see in the code snippet, I'm thoroughly commenting my code along the way. These comments are notes to my future self. In a few months, when I need to build a UI or a parent/child object relationship in my future game projects, like Of Mice and Tales, I'll have this fully built and documented project, and Justin's excellent tutorials, to reference. It's not just a game; it's a guide I can reference from my personal code library.
Stay tuned for another pin or two tomorrow!
Bootcamp #1: Asteroids Clone
My first real project in GameMaker! A deep-dive clone of Asteroids, built to master the engine's fundamentals.
Status | In development |
Author | corkboardstudio |
Genre | Action, Shooter |
Tags | Asteroids, Space, Top down shooter |
More posts
- Day 5: Collisions and SFX1 hour ago
- Day 3: Multiple Weapons & The Revenge of Linear Algebra2 days ago
- Day 2: Refactoring & Resisting (Some) Temptation3 days ago
- Day 1: The First Pin is Placed4 days ago
Leave a comment
Log in with itch.io to leave a comment.