This week in Mario: enemies!
As I spent more time polishing Mario’s movement, it became increasingly obvious that the world he was moving in was kind of boring. So although there are still some minor issues with Mario, I thought it would be more beneficial to begin working on the obstacles in his way.
Piranha
My first target, the piranha plant, was probably the easiest to work with due to its simple behavior. It pops out of a pipe, and descends back into the pipe. I got a recording of this action and plotted the movements in Physmo in order to figure out its launch velocity and relationship with gravity. This was also how I learned to use timers in my blueprint code. When the piranha re-enters a pipe, a full second needs to pass before its ready to launch again.
Rex
After I got the piranha animated, I moved onto Rex. I love rex. he’s one of my favorite enemies. Just a goofy lookin guy. It’s a shame that the only code I built for him was how to kill him. This was when I started working with custom collision layers and presets. I like Unreal’s system of ignore/overlap/block, and I really like that each blueprint can have unique collision settings, but I miss the simplicity of Unity’s collision matrix. Once I had the collision set up, I had some good jumping code that was easy to copy and paste onto my other enemies.
Banzai Bill
The next enemy was the Banzai Bill. Putting this enemy in the first level is a strange choice, but I’ve chosen to adapt this game as it is and I stand by that choice. This was my first experience with spawning entities in, and it took a fair bit of googling to understand how all that works (after you spawn a moveable class, you have to spawn a movement controller with it). I’ve thought about where to spawn the Banzai Bill for a long time, and for now I think my best option is to shoot it out of the skybox. As I write this I’ve thought of a way to incorporate it into the level geometry, but that’ll have to be work for future Kevin.
Koopa Shell
While not exactly an enemy, I built a basic Koopa shell so that I had something for Mario to hold while I built and tested his holding code. All the shell could do was get picked up and kicked, so I added in code for it to stop moving when Mario jumps on it, shoot upward if Mario’s looking up when he kicks the shell, and get destroyed if he spin jumps on it. There’s an actual Koopa in this level that I could’ve built, but its a deceptively complex enemy and I got intimidated.
What comes next?
I still need to implement a lot more polish. A cooldown timer for spawning Banzai Bills, dynamic movement for Rex so it doesn’t move blindly forward, and consistency with Mario’s jump height after bouncing on a Piranha Plant. I’ll handle all that when the time comes, but for now, I want to get as many concepts on the screen as I can. It’s exciting to see all my hard work come to life before my eyes. Just a bit more work and the level will be complete. I might even finish before 2023!