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

asked Jan 4 in Projects by ddz (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
answered Jan 4 by johnygames (1,532 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 How to use this Q&A? before posting your first questions.