Topic was automatically imported from the old Question2Answer platform.
Asked By
Thakee Nathees
I want to create an action say “move_up” when I press KEY_W but I don’t want to create it in the project settings is there any way to assign KEY_W to action “move_up” in gdscript?
# create the action 'move_up' if not already
if not InputMap.has_action('move_up'):
InputMap.add_action('move_up')
var event = InputEventKey.new()
event.scancode = KEY_W
InputMap.action_add_event('move_up', event)