Player abilities
Implementing the player’s other abilities -double jumping, dashing and changing size.
Double Jump
For the double jump implementation, a current jump count and a max jump count were added to the player class. Then whenever the user pressed space to jump, the jump function in the player class would check if the current jump count is less than the max jump count and if then jump and increment the current jump count. When the player collides with the ground again current jump count is reset back to 0. To allow the player to double jump max jump count was set from 1 jump to 2.
Dashing
The implementation for dashing is fairly simple when the user presses shift and they have the dash ability then the player’s momentum force in the physics component is briefly increased and a timer starts. Once the timer ends the player can dash again.
Changing size
The user can change their height and width separately using the arrow keys with up and down to change the height and left and right to change the width. I also implemented the ability to chose which direction to grow and shrink in by pressing w, a, s, or d at the same time. Changing width with this allows the user to move similar to a worm which is an interesting puzzle mechanic.