system
February 24, 2019, 5:18pm
1
Attention
Topic was automatically imported from the old Question2Answer platform.
Asked By
JulioYagami
Godot 2.0 had something like this:
func _input(event):
if event.scancode = some_code:
#do something
But as for 3.0 I do not know.
system
February 25, 2019, 2:11am
2
Reply From:
TyTYctA
you can find scancode of godot in enum KeyList at globalscope
enum KeyList
KEY_UP = 16777232 — Up Arrow Key
It only works if the key I’m pressing is a InputEventKey
. And as for other inputs types?. For example, I want to set a action for the joystick button the player presses.
JulioYagami | 2019-02-25 13:05
If you want to use Joypad, you can see InputEventJoypadButton , InputEventJoypadMotion and enum JoystickList in globalscope
enum JoystickList :
JOY_XBOX_Y = 3 — XBOX controller Y button
OY_ANALOG_LX = 0 — Joypad Left Stick Horizontal Axis
JOY_ANALOG_LY = 1 — Joypad Left Stick Vertical Axis
JOY_ANALOG_RX = 2 — Joypad Right Stick Horizontal Axis
JOY_ANALOG_RY = 3 — Joypad Right Stick Vertical Axis
JOY_ANALOG_L2 = 6 — Joypad Left Analog Trigger
JOY_ANALOG_R2 = 7 — Joypad Right Analog Trigger
you should see Input Remapping in Godot tutorial for understand more about input event in godot
TyTYctA | 2019-02-26 03:32