This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes
func jump():
    if Input.is_action_just_pressed("jump"):

        if is_on_floor() or hasDoubleJump:
            velocity.y=max_jump
            $Sprite.play("jump")
        if !is_on_floor():
            hasDoubleJump=false
    if Input.is_action_just_released("jump"):
        velocity.y=100
    if is_on_floor():  
        hasDoubleJump=true


func wallSlide():
    if is_on_wall() and (Input.is_action_pressed("left") or Input.is_action_pressed("right")):
        canJump=true
        if velocity.y>=0:
            velocity.y=min(velocity.y+wall_accl_slide,max_wallSLideSpeed)
        else:
            velocity.y+=gravity
func oppositeJump():
    if Input.is_action_just_pressed("jump"):
        if canJump==true:
            if is_on_wall() and Input.is_action_pressed("right"):
                velocity.x=-max_horizontalSpeed
            elif is_on_wall() and Input.is_action_pressed("left"):
                velocity.x=max_horizontalSpeed

here in opposite() function i tried to jump to the opposite wall
to the wall the player was holding.

Godot version 3.5
in Engine by (14 points)
edited by

You're gonna have to put more context than just dumping your script.

hi...
srry for dumping the entire script i have edited the question.

Having the whole script is fine, what I meant is just having more context on what did you try and what was the result.

From what I see in your opposite() method, you set velocity.x which I assume is used in a move_and_slide() method somewhere else in the code. Where do you change velocity.x in your script other than here ? Depending on how you change this value your wall jump might not work.

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.