Devlog #2: Stairs, stairs, stairs
This week’s journey into game development took me into the realm of stair mechanics within my 2D game engine. On paper, it sounds straightforward: make stairs that players can actually use. But as any good engineer knows, the devil is in the details.
The goal was to create stairs that not only look part of the world but also interact seamlessly with the player’s commands. It’s akin to programming your thermostat: it seems simple until you’re four hours deep into the user manual.
I’ve already implemented ladder climbing logic using sensors, but I decided to look into some tutorials anyway. That led me down a rabbit hole of platformer games, which were about as useful for my problem as a chocolate teapot. However, one Unity tutorial showed a similar way as my ladder logic of using sensors in the top and bottom.
After a few iterations and more coffee than I’d like to admit, I arrived at a working solution.
Let’s unpack the mechanics:
-
Initial Check: A piece of code determines if player position is below stairs middle point and disables the stairs. That way player can always run through the stairs by default, like a ghost
-
Indication: As the player approaches the sensor, an arrow appears, signaling that the stairs are within reach, akin to a polite nod from the stairs themselves.
-
Activation: The player presses up, and the stairs solidify, allowing for collision and ascent. The arrow turns green as if to say, “All systems go.” Also a temporary block for the piece of code has been set to not change collision filter.
-
The Climb: Once the player begins their ascent, the stairs remain solid, thanks to a check that confirms the player’s intention to climb.
-
Continuation: Next stairs go the same way, player activates them and starts climbing. The top floor bit is also considered as stairs, so it’s not activated until player is above it.
-
Descent: For going down, player presses down when on the stairs bit of the floor and the floor deactivates. Stairs deactivate automatically after halfway bit.
There it is: stair mechanics demystified and implemented. It’s a bit like explaining Wi-Fi to your grandparents—complex to describe but magical in action.
Have any clever tricks or feedback? Feel free to drop a comment below!
Stay tuned for more tales from the coding front. Thanks for joining me on this adventure through game development’s ups and downs—quite literally this time!
Echo Squad
Status | On hold |
Author | PostHuman Interactive |
Genre | Shooter |
Tags | 2D, Comedy, Co-op, Horror, Multiplayer, Pixel Art, Side Scroller |
More posts
- Devlog #6: Putting the Project on HoldAug 11, 2024
- Devlog #5: Moving to GodotJun 03, 2024
- Devlog #4: Networking Part 2Apr 29, 2024
- Devlog #3: Stepping Into NetworkingApr 10, 2024
- Devlog #1: Unveiling "Echo Squad" – My Leap Into Game DevelopmentMar 24, 2024
Leave a comment
Log in with itch.io to leave a comment.