-
Notifications
You must be signed in to change notification settings - Fork 0
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
Player physics improvements #6
Conversation
b126576
to
fbbf891
Compare
## How high does your character jump? Note that the gravity will | ||
## be influenced by the [member GameLogic.gravity]. | ||
@export_range(-1000, 1000, 10, "suffix:px/s") var jump_velocity = -880.0 | ||
|
||
## Can your character jump a second time while still in the air? | ||
@export var double_jump: bool = false |
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.
Yes I love that these platformer settings are part of the "moddability" (if that's a word in English).
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.
descriptivism tells us that if it's a word people use and understand, then it's a word :)
@export var double_jump: bool = false | ||
|
||
# If positive, the player is either on the ground, or left the ground less than this long ago | ||
var coyote_timer: float = 0 |
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.
Can coyote timer be turned on/off or configured from the Inspector? See https://gmtk.itch.io/platformer-toolkit for reference.
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.
I didn't make coyote time or jump buffering configurable in the inspector because they're quite non-obvious parameters with a very narrow range of sensible settings. But maybe it's OK to expose them anyway with a good tooltip, maybe in an "advanced" group.
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.
I made these configurable, as a slider whose steps are frame durations @ 60 fps, with 0
turning them off.
fbbf891
to
0782e47
Compare
0782e47
to
c6bce4e
Compare
This technique is borrowed from the MOVEMENT 2 demo available in the Godot Asset Library. It makes jumping feel a little more natural: you can do a little jump by tapping space, or a long jump by holding it a little longer.
It is common in platform games to allow the player a few frames' grace after walking off the edge of a ledge where they can still jump as if they were still standing on the ledge. This technique is inspired by the MOVEMENT 2 demo available in the Asset Library.
Previously, you could only jump if you were already on the ground when you press the jump button. This seems logical but is actually very annoying: if you press jump 1 frame too early, then you miss. It is common in platformers to allow a few frames' grace, so that you can press the jump key a few frames early and still start a jump when the player touches the ground. To implement this, count down from 0.1s (6 ticks at the default 60 ticks per second) when the jump action is just pressed. This technique is borrowed from MOVEMENT 2.
With the defaults it takes 5 frames to accelerate to the maximum speed.
c6bce4e
to
f9e6615
Compare
If enabled, the player can jump a second time while still in the air from a previous jump. A crude shower of particles is emitted to indicate ✨ magic ✨.
Previously, when the player stomped an enemy the enemy would set the player's vertical velocity directly. Instead, have the enemy call a new stomp() method on the player, which internally triggers a jump having disarmed the double-jump. This makes a difference in the following cases: - If the player has a jump buffered, stomping on the enemy now consumes that jump. - If the player is holding the jump key (because they buffered a jump) they can curtail the height of bouncing off the enemy. - If double jump is enabled, it is now armed by stomping an enemy.
f9e6615
to
b14ffa8
Compare
I gave it a try, it's impressive and moddable! |
@jbourqueendless gave the thumbs-up to the concept on Slack so I'm undrafting this |
This adds a few nice adjustments to the player controls:
I think this feels a bit nicer to play (though the jump is still a bit "floaty" for my liking). I would want learning team feedback on whether these tweaks are helpful or whether they complicate the example too much. They were fun to write though.
https://phabricator.endlessm.com/T35700
Screencast.from.2024-10-25.14-47-16.webm