Pressing CTRL + Q does also press Q, so Godot will register both events. As a default it’s nice since we can add shift to sprint without breaking all other inputs.
You can check if an action is exactly pressed in your input function using the third optional argument of is_action_pressed
func _unhandled_input(even: InputEvent) -> void:
if event.is_action_pressed("Rotate Left", false, true):
print("Only rotate left!")
bool accumulate(with_event: InputEvent) 🔗 | Inherits: Resource< RefCounted< Object Inherited By: InputEventAction, InputEventFromWindow, InputEventJoypadButton, InputEventJoypadMotion, InputEventMIDI, InputEventShortcut Abstract base c...
Previous post on a similar subject:
Turns out my code was wrong, it’s get_tree().get_root().set_input_as_handled(); but I have a better solution for you.
func _input(event: InputEvent) -> void:
if event.is_action_pressed("drop_stack", false, true) and is_in_valid_slot:
InventoryManager.trash_stack()
elif event.is_action_pressed("drop_item", false, true) and is_in_valid_slot:
InventoryManager.trash_single_item()
The false leaves the echo setting at default, and true is for exact_match. This should solve your problem even if…