0 votes

So i need to know how to reset a variable after performing wall jumping when i land on the floor
Example: i jumped on a wall until i reached the maximum (3) after i land i cannot perform wall jump again as my variable for walljumpcount = 3 which equals to maxwalljump (3)
I need a block that reset the walljumpcount back to 0 AFTER i land on the floor

Godot version 3.3.4
in Engine by (57 points)

1 Answer

0 votes

Not much is known about your project structure so assuming you're using PhysicsBodies connect the signal to the following

func on_body_collision(body):
    if "Floor" in body.name:
        if wall_jump_count >= max_wall_jump:
            wall_jump_count = 0
by (6,264 points)

Oh yeah about that i already figured it out but in a different way down at physics process i added this code:

If is_on_floor:
   wall_jump_count = 0 

Seems to be working just fine but not sure it will be after the script gets more complex

Should be fine.

A good practise is to put comments in your code blocks
So you know what makes or breaks what and debugging gets easier

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.