For our third and final assignment in Fundamentals of Game Tech class, we are required to make a platformer with the assets we made in Fundamentals of Game Art. I went for a post-apocalyptic themed game named Scavenger’s Hunt. The idea was a stealth game revolving around a girl who must find supplies and defeat enemies along the way.
One of the mechanics that I wanted to implement into the game is a ladder mechanic. It is not something that I have learned in class before, so I had to do some research for some initial ideas. During my research, I came across this link which details a solution, and I started from there.
The solution was to make regions where the ladder is placed, and if the player is in the region, he can press up or down keys. Once they do, a Boolean will be set to positive, which will then set the player's y-speed to positive or negative. Gravity is also disabled when the Boolean is positive to prevent the falling if they were still holding on to the ladder.
Before I started, I took the time to write down what the Boolean, which I named ‘isClimbing’, will decide. After a few minutes, I figured that the Boolean will:
1. Switch the player’s animation to climbing animation
2. Set the y-speed of the player to positive or negative (if up or down is pressed)
3. Prevent horizontal movement
There was one problem with this solution if I directly implemented this into my platformer. First, at the top of the ladder is a tile with a square collision box, which must exist or else the player will fall off the map as soon as they reach the top of the ladder.
There was an easy fix for this as my character had different animations when climbing. All I need to do was set the climbing animations’ collisions to be ‘sensors’, which do not produce ‘solid’ responses to collisions. In other words, the player can phase through tiles when climbing.
Speaking of animations, because I made two climbing animations which cycle between the player having their left or right hand up to make a realistic climbing animation. I made it so that while the player ‘is climbing’ and they are pressing up or down, the animation will change frames every 0.2 seconds. This makes it so that the animation will pause if the player is not going up or down the ladder, but is still holding on the ladder.
There are some bugs in Stencyl which have frustrated, especially when I adjust the size and coordinates of Regions. These are fixed when restarting Stencyl, but over and over again I had thought that it was a problem within the code itself.
Bugged game build before restarting Stencyl
Working game build after restarting Stencyl
Also, as seen in the video, the Boolean values of ‘isClimbing’ and the y coordinates of the player is constantly shown and updated. This is a habit I have developed which I felt will help me identify bugs or logic errors easier if there was any.
Although it took me a while to experiment with a feature that might not be necessary for my game, I was glad to learn a bit more about how ladders in platformers work, and hopefully, I will be able to implement some code I learnt here on other movement behaviours in the future.
Stay tuned for the full Scavenger’s Hunt game, which features guns, bandits and hopefully ladders!
Comments