Why Research is Important

This week, I was learning how to make basic animation for a player walking in a top-down map. I wanted to include a button that, when held down, would make the player walk faster. This was to be mapped to the left Shift key.

I tried to use the Unity methods GetButton to allow the player to move faster and the GetButtonUp function to return him to his default speed, but the key was not registering when pressed. I then proceeded over the course of the next couple of days to do some research to determine the problem, and finally found out I had to use an "else if" conditional between the two methods instead of an "if" conditional. This finally allowed the Shift key to trigger correctly, thereby resolving the issue.

The moral is this. If you are having trouble getting a method to work correctly, find examples of its proper usage to make sure you are writing the code correctly.

This coming week I will start to learn about camera control and then move on from there. Come back next week to see where that leads. Thanks for reading.

Comments

Popular posts from this blog

Dabbling with 2D RPG Creation

Post 0: A Little Bit About Myself