Skip to content

Commit 26f4cd0

Browse files
committed
COE prep - profanity filter, scenario screen, improved high scores list
1 parent 054e3ba commit 26f4cd0

File tree

10 files changed

+2690
-46
lines changed

10 files changed

+2690
-46
lines changed

.yarn/install-state.gz

78 Bytes
Binary file not shown.
1.21 KB
Loading

src/components/Game.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { MenuScene } from "../game/scenes/MenuScene";
77
import { GameOverScene } from "../game/scenes/GameOverScene";
88
import { NameEntryScene } from "../game/scenes/NameEntryScene";
99
import { HighScoresScene } from "../game/scenes/HighScoresScene";
10+
import { ScenarioScene } from "../game/scenes/ScenarioScene";
1011

1112
const Game = () => {
1213
const [device, setDevice] = useState<HIDDevice | null>(null);
@@ -34,6 +35,7 @@ const Game = () => {
3435
GameOverScene,
3536
NameEntryScene,
3637
HighScoresScene,
38+
ScenarioScene,
3739
],
3840
});
3941
}, 50);
@@ -89,15 +91,15 @@ const Game = () => {
8991

9092
useEffect(() => {
9193
if (device) {
92-
(gameRef.current?.scene.getScene("GameScene") as GameScene)?.setDevice(
93-
device
94-
);
94+
(
95+
gameRef.current?.scene.getScene("ScenarioScene") as GameScene
96+
)?.setDevice(device);
9597
} else {
9698
(
97-
gameRef.current?.scene.getScene("GameScene") as GameScene
99+
gameRef.current?.scene.getScene("ScenarioScene") as GameScene
98100
)?.closeDevice();
99101
}
100-
}, [device, gameRef.current]);
102+
}, [device, gameRef, gameRef.current]);
101103

102104
const onDeviceConnect = useCallback((device: HIDDevice) => {
103105
setDevice((existing) => {

src/game/config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { GameOverScene } from "./scenes/GameOverScene";
44
import { MenuScene } from "./scenes/MenuScene";
55
import { NameEntryScene } from "./scenes/NameEntryScene";
66
import { HighScoresScene } from "./scenes/HighScoresScene";
7+
import { ScenarioScene } from "./scenes/ScenarioScene";
78

89
export const gameConfig: Phaser.Types.Core.GameConfig = {
910
type: Phaser.AUTO,
@@ -18,7 +19,14 @@ export const gameConfig: Phaser.Types.Core.GameConfig = {
1819
debug: false,
1920
},
2021
},
21-
scene: [MenuScene, GameScene, GameOverScene, NameEntryScene, HighScoresScene],
22+
scene: [
23+
MenuScene,
24+
GameScene,
25+
GameOverScene,
26+
NameEntryScene,
27+
HighScoresScene,
28+
ScenarioScene,
29+
],
2230
scale: {
2331
parent: "game-container",
2432
mode: Phaser.Scale.FIT, // scale up to fit the parent

0 commit comments

Comments
 (0)