diff --git a/src/engine/internal/input.ts b/src/engine/internal/input.ts index 8d8253a..81f678f 100644 --- a/src/engine/internal/input.ts +++ b/src/engine/internal/input.ts @@ -111,6 +111,14 @@ class Input { return this.#mousePosition; } + isAnyKeyDown(...keys: string[]) : boolean { + for (const k of keys) { + if(this.isKeyDown(k)) { + return true + } + } + return false + } isKeyDown(key: string): boolean { return this.#keyDown[key]; } diff --git a/src/huntmode.ts b/src/huntmode.ts index b20eeb0..d04b43f 100644 --- a/src/huntmode.ts +++ b/src/huntmode.ts @@ -155,19 +155,19 @@ export class HuntMode { let mvdx = 0; let mvdy = 0; - if (I.isKeyDown("w")) { + if (I.isAnyKeyDown("w", "k", "ArrowUp")) { touched = true; mvdy -= amt; } - if (I.isKeyDown("s")) { + if (I.isAnyKeyDown("s", "j", "ArrowDown")) { touched = true; mvdy += amt; } - if (I.isKeyDown("a")) { + if (I.isAnyKeyDown("a", "h", "ArrowLeft")) { touched = true; mvdx -= amt; } - if (I.isKeyDown("d")) { + if (I.isAnyKeyDown("d", "l", "ArrowRight")) { touched = true; mvdx += amt; } diff --git a/src/openingscene.ts b/src/openingscene.ts index 7aa1481..be6ba1b 100644 --- a/src/openingscene.ts +++ b/src/openingscene.ts @@ -17,5 +17,5 @@ Your Progenitor -PS: Left mouse + WASD. Like Quake!`, +PS: Left mouse + WASD. Like Quake! Arrows or HJKL work too.`, ]);