Week 2: Moving Around
- Sean Murray
- Feb 16, 2018
- 1 min read
The main focus of this week has been to move the player around the level. For this,the player has to be able to move in any direction, however it needs to save the last direction to be used by the animator or other mechanics.

In the current level design, there is plans for multiple tiers in the same room that the player will be able to move between. The player will be able to jump down from a higher tier to a lower tier in some places, and use ramps and ladders to be able to climb to higher tiers from lower. Because of this, the movement script needs to take into account when the player is touching a ledge, and determine if the player wants to jump down off of it, or just walk beside it. The script also needs to handle the movement of jumping off the ledge, and also the collision.

The method I am using for this is the Unity Message OnCollisionStay2D to detect if the player is colliding with a ledge, and if they are moving so they are jumping off. If the player is, then it runs a co-routine to move the player down to the lower tier. I used a co-routine here for efficiency as I didn't want to waste processing time checking to see if the player should be moving in an update message.
Comentarios