Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
670 stars 72 forks source link

Player can enter the sprinting state midair #172

Closed aronand closed 3 weeks ago

aronand commented 2 months ago

Cogito and Godot Engine Version: Godot: 4.2.1 Cogito: 6d9f37e

Description: The current implementation of the player controller allows the player to enter the sprinting state even when not on the ground.

Reproduction steps:

  1. Move forwards
  2. While still moving forward, press the jump button
  3. While still moving forward, press the sprint button

Expected behavior: I'm guessing the intended behavior is that the speed boost from sprinting can only be attained while on the ground.

Screenshots: N/A

PeterD23 commented 3 weeks ago

Looking at cogito_player.gd#487, it seems the obvious fix is to add a and is_on_floor() check to the sprint input, but I think this negates the momentum gained from jumping during a sprint, so I'm wondering if theres a way to retain the momentum from sprinting while locking the input away whilst the player is in midair?

Phazorknight commented 3 weeks ago

Thanks for the patience with this one, I just hadn't had time to look into this.

@PeterD23 you're right, though I'd actually put the check a bit later and it seems to do the trick: image

I've just pushed the update to this, let me know if you encounter any issues.

Phazorknight commented 3 weeks ago

Oops, didn't mean to close this.

Phazorknight commented 3 weeks ago

As this seems to be solved "good enough" now, I'm closing this issue.