DashJumping in Godot

Godot Version

Godot 4.2

Question

I have an issue with backward movement in Godot
specifically, Godot4.2

**This is how I get my move_direction **

move_direction.z = Input.get_action_strength("Right") - Input.get_action_strength("Left")

Now this is how I walk

if isWalking and move_direction.length() > 0.1:
        current_speed=move_direction.z * speed * delta
        velocity.z = current_speed
        current_anim = WALK
    elif !isWalking:
        velocity.z = move_toward(velocity.z, 0, delta *3)

Now the problem is here in running and jumping

if isJumping:
        velocity.y = abs(move_direction.z + current_speed)/2 + jumpStrength
        snapVector = Vector3.ZERO
        current_anim= JUMP
    elif justLanded:
        snapVector = Vector3.DOWN
        current_anim= LANDING
        
    
    if isRunning and move_direction.length() > 0.2:
        current_speed = move_direction.z * speed * 4 * delta
        velocity.z = current_speed
        current_anim = RUN
    elif !isRunning:
        velocity.z = move_toward(velocity.z, 0, delta* 6) 

Now this place allows me to jump with my current velocity.z to get a nice-looking dash jump right but the issues is I can’t dash jump backwards and it’s because at that point move_direction is negative, and I don’t know how to handle it when its negative I’ve tried making the current_speed negative if the length is < 0.2 but no dice
then I tried using abs(move_direction), but this made it impossible to turn backwards while running

Please help

Issues is solved i just needed to care for each direction respectively, meaning is had to make variables such as isRunningLeft and isRunningRight

1 Like