Need help with cospaces scripting

Can someone explain what
onKeyDown(handler: function, keyCode: [KeyCode]): void
means?

Hi @Bunny,

The handler is a function (or the name of one) which contains the code you want to run when the key is pressed.
The keyCode is a string constant which contains the key which runs that handler. See https://cospaces.io/api/modules/input.html#keycode for a list of key codes.

For example: Input.onKeyDown(function(){},'left_mouse_button') uses an empty function as a handler, so nothing will happen when the left mouse button is pressed down (prevents clicks).

Note: onKeyDown + onKeyUp = onKeyPressed

Hope that helps! Let me know if you have any further questions.

Geoff @ TechLeap