-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve in-air behavior for crouch and slide jumps #82
Conversation
4ae1b12
to
7230601
Compare
7230601
to
a21abae
Compare
I saw they were still recent commits, so I held off. Let me know when I can review. |
You're all set to review actually @Phazorknight, just wrapped it up. The more recent commits were minor addendums to the overall PR. |
…nto crouch_jump_patch
Gave this a test and noticed that when I sprint > crouch > jump, I leap higher than with a regular jump (see video). 2024-02-23.11-27-35.mp4 |
So, how would you like that to be handled? That's the slide jump modifier, which I've not changed the factor of, just split it out into its own variable The reason it's higher than without this branch is I've made it so slide jumps put you into standing mode in terms of where the head camera gets placed. I can make it so you stay at crouched height instead visually, though ultimately you're still coming off the ground higher than a regular jump. |
@@ -537,10 +559,12 @@ func _physics_process(delta): | |||
animationPlayer.play("jump") | |||
Audio.play_sound(jump_sound) | |||
if !sliding_timer.is_stopped(): | |||
velocity.y = JUMP_VELOCITY * 1.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Phazorknight this is where you can see the original jump being made higher when jumping from a slide.
Oh, apologies, I didn't realize this was an intended modifier. That's what I get for rushing. Will finish my review after lunch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Really nice to have these new exported properties.
Thank you!
This is a little prescriptive to what I found "feels right", but in response to #79, I've modified how crouch and slide jumps feel and look.
In #79, @ksjfhor found that un-crouching mid-air would look as though there's a sudden upwards velocity to exactly where you'd expect the jump to be if you had done it standing. It is merely a visual effect from the camera moving from the crouched height to the standing height, the jump is functionally exactly the same. The only thing that changes is the camera height, and the collision to make collisions consistent with what the player is seeing.
I personally find this behavior makes for consistent functionality both as a player and as a dev trying to find the right game feel. When crouch jumping, the characters feet comes off the ground by exactly the same amount whether crouched or standing.
To address the visual jitter, I made it so you can't change your standing/crouching state visually whilst jumping. This feels a little prescriptivist, but I think is the neatest solution for right now with minimal compromise in terms of actual game functionality and feel. If you're making a parkour game however, you may find you need to alter this behavior with a custom solution to resolve this, but that likely would've been the case anyways.
I also changed the in-air behavior. If you're crouched and in-air, you will consistently have the crouch movement speed, unless you're jumping from a slide. If you're slide jumping, your character will largely be registered as being in the "standing" state, which also includes having the camera in the standing state.
I've added 2 parameters for devs to be able to dial in their game feel:
CROUCH_JUMP_VELOCITY
- what force your jump should have if crouch jumpingSLIDE_JUMP_MOD
- modifier to how strong your jump is coming from a slide