game: cleanup

This commit is contained in:
He4eT 2025-06-16 12:42:36 +02:00
commit d0e0b26411

11
game.js
View file

@ -182,7 +182,7 @@ function handleMorse() {
const { key } = player const { key } = player
const now = time() const now = time()
const buttonPressed = [BTN_A, BTN_B, BTN_X, BTN_Y].map(btn).some(Boolean) const buttonPressed = [BTN_A, BTN_B, BTN_X, BTN_Y].some(btn)
/* Down */ /* Down */
if (buttonPressed && !key.isDown) { if (buttonPressed && !key.isDown) {
@ -704,12 +704,9 @@ function drawSprite(spriteIndex, x, y) {
} }
function anyKeyPressed() { function anyKeyPressed() {
for (let i = 0; i < 8; i++) { return arr(8)
if (btnp(i)) { .map((_, i) => i)
return true .some(btnp)
}
}
return false
} }
/* Constants */ /* Constants */