Player Controller
Updated: Jun 6, 2023
- Used Brackeys 2D Character Controller as the base for my 2D Character Controller, removing what I didn't need and adding what I do
1) jumpForce calculated based on how long the JUMP key is held <SPACE>.
2) Player will automatically jump after hitting the max jumpForce.
3) Jump direction based only on whether directional key is held while"charging" the jump <rightArrow> or <leftArrow>. Player will jump straight upward only if no arrow key is held.
4) Player cannot move while "in the air". The jump path is fixed as soon as the jump key is released or the jumpForce maxes out.
5) Player cannot move while "charging up the jump".
6) If player collides with terrain while jumping, there is a deflection/bounce-off effect.
----------------------
6/5/23
Left/right movement working
7/5/23
Jump movement working
![](https://static.wixstatic.com/media/7f9113_4d3b25e4f3c842f9ac6023087f6a56f7~mv2.gif)
9/5/23
Added charge jumping
![](https://static.wixstatic.com/media/7f9113_b44506b5e7044a5684b36d777477dc5a~mv2.gif)
References
Brackeys (2018) 2D Movement in Unity (Tutorial). YouTube. [online]. Available from: https://youtu.be/dwcT-Dch0bA [Accessed May 1, 2023].
Brackeys (2018) Brackeys/2D-Character-Controller: Free 2D Character Controller for Unity. GitHub. [online]. Available from: https://github.com/Brackeys/2D-Character-Controller [Accessed May 1, 2023].
Comentarios