Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

godot - Character not jumping away from wall

Been learning GDScript and trying to make a simple platformer game. I've tried implementing WallJumping, but it is not working.

This is the logic: Character has ray casts on it that detect collision. when collision is detected, it resets "Jump_Left" (so it can double jump) And adds Motion.x on the opposite direction of the collision. (So the character jumps away from the wall)

It is not adding the motion.x. And character is jumping up normally.

if Input .is_action_just_pressed("ui_accept") and jumps_left > 0:
        if motion.y > 0: motion.y = 0
        motion.y = PULO_ALT
        jumps_left -= 1
        print("-2")
        $Sprite.play("Jump")
        ### Wall Jump
        if not is_on_floor() and  Na_Parede_Esq():
            motion.x += WALLSPEED
            print("Esquerda")
        if not is_on_floor() and  Na_Parede_Dir():
            motion.x -= WALLSPEED 
            print("direita")
    if Input . is_action_just_released("ui_accept") and motion.y  < 0:
        motion.y = 0
            
    if not is_on_floor() :
        $Sprite.play("Fall")

Yall have any ideas ?

(I know raycast is working, since it prints "Esquerda" and "Direita")

question from:https://stackoverflow.com/questions/65648232/character-not-jumping-away-from-wall

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...