Skip to content

Commit a9b997e

Browse files
committed
Add a refresh button.
1 parent 8088a99 commit a9b997e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Game.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import SinglePlayer from "./nodes/SinglePlayer";
55
import Multiplayer from "./nodes/Multiplayer";
66
import Background from "./nodes/Background";
77
import { initSounds } from "./audio";
8+
import { inputs } from "./inputs";
89

910
export default class Game {
1011
async start() {
@@ -22,6 +23,13 @@ export default class Game {
2223
// Append the application canvas to the document body
2324
document.getElementById("app")!.appendChild(app.canvas);
2425

26+
// Button to manually refresh the app
27+
document.addEventListener("keydown", (e) => {
28+
if (e.key === inputs.refresh) {
29+
window.location.reload();
30+
}
31+
});
32+
2533
const background = new Background();
2634

2735
const menu = new Menu(background);

src/inputs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface PlayerInput {
77
hold: string;
88
}
99
export const inputs = {
10+
refresh: "r",
1011
pause: "p",
1112
player1: {
1213
left: "a",

0 commit comments

Comments
 (0)