PlayerController/Health


The player controller I made was a very simple adaptation of the one we made for our Unit 3 class project. It includes basic inputs for movement directions as well as camera movement controls. While I was creating it, I tried to find ways to streamline it and innovate upon it, but it's such a fundamental type of script that I found improving it fairly difficult. We did run into one issue with my original set-up, however. The player can press the WASD buttons to move in cardinal directions, but can also combine those key presses to move diagonally. When the player did so, due to my set-up, the player would actually move faster diagonally than they would otherwise. This was a minor problem, but one that we wanted to fix for consistency reasons. I ended up rewriting the movement code so that the speed was always clamped between a given range. This worked perfectly, although I laugh at it in retrospect because it turns out there is a single addon that does exactly what I was trying to do; .normalized. I found this out afterwards, credit to Leo Andrade. Although my way of going about it was a bit more complicated than it needed to be, I'm still proud of coming up with a solution to a problem on my own, on the fly, without needing any direct instruction. It always blows me away how many tools there are in C# programming that are incredibly useful, unless you are simply unaware of them.

As for the Health script, it was also simply designed solely to keep track of raw health numbers. Also included were a few basic methods for taking damage, getting healed, and dying. Though these methods did very little at first, I knew they were things we were going to need to do in the future so I saw fit to lay the groundwork on first pass.


-Griffin

Get Sanguine Falls

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.