@al-engine/key_inputs

Module for handle key inputs in Al engine. Minimalistic game engine, for pixel perfect games

Usage no npm install needed!

<script type="module">
  import alEngineKeyInputs from 'https://cdn.skypack.dev/@al-engine/key_inputs';
</script>

README

Al engine

Core

Module for handle key inputs in Al engine

// creating instance
const keyInputs = new KeyInputs();
// then initiate
keyInputs.init();

// each frame collect a key data
const result = keyInputs.collect();

// collected data have arrays with pressed and hold key 
result.keysPress;
result.keysHold;

// and functions to check witch key was pressed and hold
result.isPressed('w');
result.isHolded(' ');

// you can clean listeners if needed
keyInputs.clean();