Posted July 22, 2024 by Lord Unchemael
In Not so Trash Panda, there are several things you are able to climb, such as the lattice on a few of the houses or a drainpipe that will fall when reaching the top. This climbing system has gone over quite a few changes over the development of this game, so I am going to go over some of these iterations and how I came to the currently used system.
Each of the empty game objects have functions as stated below:
With this original system came a few problems. The most noticeable problem being that the width of this climbable object did not match the lattices very well so I had three of these individual objects right next to each other. This would function mostly as you would expect, but occasionally the player would collide with two at once and end up climbing at super speed.
As you can see here, I ended up having a bunch of potential target locations for the player to run to. When colliding with the barking area, the player will run to the closest of the targets. After making this doghouse script I knew I had to use this system for the climbing as well. In order to make this work as best as possible, I would change the script for climbing to use an array for the three target objects as opposed to just the single object. This way I could modularly make the climb as wide as I need depending on the climbable area. This is shown in this lattice here. The climbable object is wide enough to fit the width of the lattice and uses three sets of target objects.
Looking back at the process I went through to make this system, it amazes me how obvious it should have been to me to make the system like this from the start. This goes to show that having the right end-goal in mind is very important for making an effective script without needing to rework it too many times. That being said, I hope you learned something useful about game objects being used as targets, and I thank you for reading till the end!