Skip to content

Instantly share code, notes, and snippets.

@mlkvs
mlkvs / UInput.md
Created July 6, 2024 20:37 — forked from ze0nni/UInput.md
UInput.ts Input API for cocos creator

How to use

Add UInput.ts to your project and just call UInput.*** from anywhere

if (UInput.getKeyDown(KeyCode.SPACE))
            console.log('FIRE')

const moveX = UInput.getKeyAxis(KeyCode.ARROW_LEFT, KeyCode.ARROW_RIGHT);
const moveY = UInput.getKeyAxis(KeyCode.ARROW_DOWN, KeyCode.ARROW_UP);