0 votes

Hello,
I'm trying to wall jump in a 2d platformer. I'd like for the character to move horizontally when they jump off the wall (i.e. diagonally). The character moves vertically smoothly and perfectly, but horizontally they "skip" and instantaneously jump from their current location to the new horizontal location. Thoughts?

if nextToRightWall() and !is_on_floor() and Input.is_action_just_pressed("jump" + action_suffix):
    return Vector2(100, -500)
elif nextToLeftWall() and !is_on_floor() and Input.is_action_just_pressed("jump" + action_suffix):
    return Vector2(100, -500)
else:
    velocity.x = speed.x * direction.x
in Engine by (12 points)

1 Answer

0 votes

I am no expert (I am new to Godot and GDScript), but could lerp (I believe linear interpolation) work?

See: https://docs.godotengine.org/en/stable/classes/class_@gdscript.html#class-gdscript-method-lerp

If not then maybe Quat SLERP (spherical linear interpolation)?

Also what about multiplying by deltaTime (I believe in Godot it's just delta)?

by (23 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.