convert infiltration to use key instead of keyCode

This commit is contained in:
Olivier Gagnon
2021-10-27 20:52:16 -04:00
parent 6835cbaa26
commit b1328b02ce
9 changed files with 24 additions and 24 deletions
+9 -9
View File
@@ -3,18 +3,18 @@ export function random(min: number, max: number): number {
}
export function getArrow(event: KeyboardEvent): string {
switch (event.keyCode) {
case 38:
case 87:
switch (event.key) {
case "ArrowUp":
case "w":
return "↑";
case 65:
case 37:
case "ArrowLeft":
case "a":
return "←";
case 40:
case 83:
case "ArrowDown":
case "s":
return "↓";
case 39:
case 68:
case "ArrowRight":
case "d":
return "→";
}
return "";