How to check if a key is pressed while we are holding another key in godot?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TopBat69

Hi, I am making a platformer in godot, mainly inspired by celeste. I have got all the main mechanics working well but have one problem. In the game you can dash, if you want you can dash forward and can dash upward. I want my character to dash upward when you press the dash key while holding the jump key. I have tried some ways to get this working but none of them seems to work well. Does anyone have a working solution for this?

:bust_in_silhouette: Reply From: Calinou

If you’re using input actions, this should work:

func _input(event):
    if event.is_action_pressed("jump") and event.is_action_pressed("dash"):
        print("Jump and dash")

If you need to check outside of _input():

func _process(delta):
    if Input.is_action_pressed("jump") and Input.is_action_pressed("dash"):
        print("Jump and dash")