Godot Version
Godot 4.7.1
Question
Hello, I’m starting programming with Godot and I’m very new in this so I’m sorry if I ask for clarification on certain things, well the problem is that i made a shoot system for my character, it worked fine until I wanted to add up and down shoots, I want to shoot when the player press the E button and shoot down or up when the player press the E button AND the S or W button, when I tried to do it, the character began to shoot the Horizontal Shoot and the Down Shoot, I would appreciate some help thanks.
hard to say what the problem is, can you share some relevant code?
You would need to check if two keys are pressed at the same time. E.g.
func _process(delta):
if Input.is_key_pressed(KEY_E) and Input.is_key_pressed(KEY_W):
print("E and W keys are pressed concurrently.")
if Input.is_key_pressed(KEY_E) and Input.is_key_pressed(KEY_S):
print("E and S keys are pressed concurrently.")
Orsomething like this.
func _process(delta):
var a_held = Input.is_action_pressed("action_a")
var b_held = Input.is_action_pressed("action_b")
var a_just = Input.is_action_just_pressed("action_a")
var b_just = Input.is_action_just_pressed("action_b")
# Triggers if A is held and B was just clicked, or vice-versa
if (a_just and b_held) or (b_just and a_held):
trigger_combo_action()
Disable horizontal shooting if up or down are also pressed.