2021-06-13 17:05:40 +02:00
|
|
|
export function random(min: number, max: number): number {
|
2021-09-05 01:09:30 +02:00
|
|
|
return Math.random() * (max - min) + min;
|
2021-06-13 17:05:40 +02:00
|
|
|
}
|
|
|
|
|
2021-09-25 04:15:19 +02:00
|
|
|
export function getArrow(event: KeyboardEvent): string {
|
2021-10-28 02:52:16 +02:00
|
|
|
switch (event.key) {
|
|
|
|
case "ArrowUp":
|
|
|
|
case "w":
|
2021-09-05 01:09:30 +02:00
|
|
|
return "↑";
|
2021-10-28 02:52:16 +02:00
|
|
|
case "ArrowLeft":
|
|
|
|
case "a":
|
2021-09-05 01:09:30 +02:00
|
|
|
return "←";
|
2021-10-28 02:52:16 +02:00
|
|
|
case "ArrowDown":
|
|
|
|
case "s":
|
2021-09-05 01:09:30 +02:00
|
|
|
return "↓";
|
2021-10-28 02:52:16 +02:00
|
|
|
case "ArrowRight":
|
|
|
|
case "d":
|
2021-09-05 01:09:30 +02:00
|
|
|
return "→";
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|