I noticed that the player's height does not return back to 0 if they drop into a hole mid-jump. Thus, the player ends up inadvertently gaining the ability to fly until pressing the jump button again. This PR simply adds a check to PlayerStateMachine.gd to determine whether the player is switching to a state that would prevent the jump state's update method from completing the jump. If so, then the jump state's height is set to 0 with a newly added setter method in Jump.gd
I'm not sure if we intend to have the player able to jump over those holes in the future, but I think until that decision is made, this fixes an easily reproducible bug.
[X] Jump.gd: Added set_height as setter for the height field
[X] Jump.gd: Slightly refactored animate_jump_height to call set_height
[X] PlayerStateMachine.gd: Added check for a state transition to a state that would interrupt Jump from bringing the player's height back to 0, in which case the height is now set to 0
I noticed that the player's height does not return back to 0 if they drop into a hole mid-jump. Thus, the player ends up inadvertently gaining the ability to fly until pressing the jump button again. This PR simply adds a check to PlayerStateMachine.gd to determine whether the player is switching to a state that would prevent the jump state's update method from completing the jump. If so, then the jump state's height is set to 0 with a newly added setter method in Jump.gd
I'm not sure if we intend to have the player able to jump over those holes in the future, but I think until that decision is made, this fixes an easily reproducible bug.