0 votes

I'm making a Metroidvania and i wanna make a down air attack.
Down key + attack button on the air, how do i do that?.
I'm a Beginner

in Engine by (14 points)

1 Answer

+1 vote

First you need to set up the Input Map. I guess you have already set up a key for "down" and another one for "attack". In the _process(delta) function you can write the following condition:

if Input.is_action_pressed('ui_down') and Input.is_action_pressed("attack"):
    down_air_attack() # function that handles the attack

Now you say this should only happen when you are airborne. Then create a boolean value named airborne, set it to true when the character is in the air and write:

if Input.is_action_pressed('ui_down') and Input.is_action_pressed("attack") and airborne==true:
    down_air_attack() # function that handles the attack
by (1,890 points)
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.