How do i disable controls

4.3

Hi, I need help trying to disable my characters controls while mid-air

You could prepend any input functions with if not is_on_floor():. It may help to share some of your code that handles input in the first place.

1 Like

I plan on using a if is_on_floor(): statement but i don’t know what to put in the statement

You can use the floor test more than once if you need to, or you can do something like:

func _update(float delta):
    var airborne = !is_on_floor()

    [...]

    if get_jump_button_pressed():  # or whatever...
        if airborne:
            stomp()
        else:
            jump()

    [...]
1 Like

Ok thx I figured out another solution as well all you have to do is put a if is_on_floor(): before any chunk of code that involves movement, this was easy as I am using godot’s built in starter code

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.