Prevent default keypress behavior
This commit is contained in:
1 parent
d749615fed
commit
a5fa585d11
2 files changed
+3
-3
No files matched your search
@@ -1,5 +1,5 @@
|
||||
const input = {};
|
||||
|
||||
document.addEventListener('keydown', ({key}) => input[key] = true);
|
||||
document.addEventListener('keyup', ({key}) => input[key] = false);
|
||||
document.addEventListener('keydown', (e) => {input[e.key] = true; e.preventDefault()});
|
||||
document.addEventListener('keyup', (e) => {input[e.key] = false; e.preventDefault()});
|
||||
export function key(key) {return input[key]}
|
||||
@@ -285,7 +285,7 @@ function drawStatus() {
|
||||
const {currentWeapon} = player;
|
||||
const weaponType = player.weapons[currentWeapon];
|
||||
const weapon = WEAPON_TYPES.find(x => x.id === weaponType.type);
|
||||
drawText(foreground, `NRG:${player.energy} AIM:${player.a} PWR:${player.p} ${weapon.name} ${clamp(0, weaponType.ammo, 99)}`, 8, 8, player.c, 'left');
|
||||
drawText(foreground, `NRG:${player.energy} AIM:${player.a} PWR:${player.p} ${clamp(0, weaponType.ammo, 99)} ${weapon.name}`, 8, 8, player.c, 'left');
|
||||
drawText(foreground, `WIND: ${wind<=0?'<':''}${Math.abs(wind)}${wind>=0?'>':''}`, W-8, 8, 'white', 'right');
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user