Godot Version
v4.6.1.stable.official [14d19694e] macOS
Question
My keyboard’s shift key feels a bit funny right now and I don’t feel comfortable pushing it very hard to sprint for long periods of time. I think I would like to be able to press caps lock and, while caps lock is on, emulate the pressing of the shift key. Currently this is the code I have for detecting inputs:
func _input(event: InputEvent) -> void:
mv_up = Input.is_action_pressed("player_up")
mv_down = Input.is_action_pressed("player_down")
mv_right = Input.is_action_pressed("player_right")
mv_left = Input.is_action_pressed("player_left")
is_running = Input.is_action_pressed("player_sprint")
if is_running:
move_speed = sprint_speed
else:
move_speed = walk_speed
(mv_up, mv_down, etc., is_running, move_speed, walk_speed, and sprint_speed are all already declared. The actual movement is handled in _physics_process. The player is moving left, right, up, and down on the screen.)
Is there any way I can detect if the caps lock is on so I can or it with is_running’s Input call?