After giving the player the ability to dig down, there
was no way back up. This needed changing and to do so, I added ladders. Getting
the functionality right for these was tricky, and they still didn’t end up
perfect and will need further tweaking down the line. One of the issues I have
with them at the moment is that they can be placed almost anywhere, as long as
they aren’t on top of another ladder. This means that they aren’t correctly
aligned with the world space, which is something that I will look to improve later
down the line. For now, they have functionality (mostly) as intended, and fulfil
their purpose.
The Ladder uses a box collider that, when colliding with
the Player, will trigger a variable to true which allows the Player’s movement
to be changed. Once this happens, gravity gets disabled on the Player’s rigid
body. For these ladders to be implemented into the game however, they need to
be purchased from the shop. This means that the buy menu required setting up.
Setting up the buy menu was much easier than I thought it
would be. All I had to do was create a list, which I could then drag items into
it from the inspector within Unity. I had a choice between using scriptable
objects or prefabs. In this case, seeing as different items would need
different data, I chose to use prefabs.
Something I
wasn’t happy with was the interaction with ores. After mining them, but not to
the point of being destroyed, they would remain on the health that they got
down to indefinitely. This meant that it was constantly in one state or
another, resulting in many ores being cracked at once. This interaction just
didn’t seem to suit the game, so to change I added in a system that regenerates
health should the player stop mining.
No comments:
Post a Comment