Skip to content

Commit 97e3ed1

Browse files
committed
Add Skip Tutorial checkbox to menu screen
- Added checkbox on menu to skip tutorial and go directly to HouseScene - Checkbox marks tutorial as complete when used - Adjusted button spacing to fit new UI element
1 parent d542054 commit 97e3ed1

6 files changed

Lines changed: 1218 additions & 1171 deletions

File tree

Lines changed: 1164 additions & 1164 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/index-B2AXv8O8.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/index-CFrwp4BW.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232
</style>
3333
<link rel="modulepreload" crossorigin href="data:text/javascript;base64,Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPXBoYXNlci1sMHNOUk5LWi5qcy5tYXAK">
34-
<script type="module" crossorigin src="./assets/index-CFrwp4BW.js"></script>
34+
<script type="module" crossorigin src="./assets/index-B2AXv8O8.js"></script>
3535
</head>
3636
<body>
3737
<div id="game-container"></div>

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
display: block;
3131
}
3232
</style>
33-
<script type="module" crossorigin src="./dist/assets/index-CFrwp4BW.js"></script>
33+
<script type="module" crossorigin src="./dist/assets/index-B2AXv8O8.js"></script>
3434
<link rel="modulepreload" crossorigin href="./dist/assets/phaser-l0sNRNKZ.js">
3535
</head>
3636
<body>

src/scenes/MenuScene.ts

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export class MenuScene extends Phaser.Scene {
66
private seedInputText: string = '';
77
private seedInputBox?: Phaser.GameObjects.Text;
88
private isInputActive: boolean = false;
9+
private skipTutorial: boolean = false;
910

1011
constructor() {
1112
super({ key: 'MenuScene' });
@@ -95,6 +96,48 @@ export class MenuScene extends Phaser.Scene {
9596
const inputZone = this.add.zone(width / 2 - 200, 360, 400, 50).setOrigin(0, 0);
9697
inputZone.setInteractive({ useHandCursor: true });
9798

99+
// Skip Tutorial checkbox
100+
const checkboxY = 450;
101+
const checkboxSize = 20;
102+
const checkboxX = width / 2 - 80;
103+
104+
// Checkbox background
105+
const checkboxBg = this.add.graphics();
106+
checkboxBg.fillStyle(0x2c3e50, 1);
107+
checkboxBg.fillRect(checkboxX, checkboxY, checkboxSize, checkboxSize);
108+
checkboxBg.lineStyle(2, 0x95a5a6, 1);
109+
checkboxBg.strokeRect(checkboxX, checkboxY, checkboxSize, checkboxSize);
110+
111+
// Checkmark (initially hidden)
112+
const checkmark = this.add.text(checkboxX + checkboxSize / 2, checkboxY + checkboxSize / 2, '✓', {
113+
fontSize: '16px',
114+
color: '#2ecc71',
115+
fontStyle: 'bold',
116+
}).setOrigin(0.5);
117+
checkmark.setVisible(false);
118+
119+
// Checkbox label
120+
this.add.text(checkboxX + checkboxSize + 10, checkboxY + 2, 'Skip Tutorial', {
121+
fontSize: '16px',
122+
color: '#ecf0f1',
123+
});
124+
125+
// Make checkbox interactive
126+
const checkboxZone = this.add.zone(checkboxX, checkboxY, 150, checkboxSize).setOrigin(0, 0);
127+
checkboxZone.setInteractive({ useHandCursor: true });
128+
129+
checkboxZone.on('pointerdown', () => {
130+
this.skipTutorial = !this.skipTutorial;
131+
checkmark.setVisible(this.skipTutorial);
132+
133+
// Update checkbox appearance
134+
checkboxBg.clear();
135+
checkboxBg.fillStyle(this.skipTutorial ? 0x27ae60 : 0x2c3e50, 1);
136+
checkboxBg.fillRect(checkboxX, checkboxY, checkboxSize, checkboxSize);
137+
checkboxBg.lineStyle(2, this.skipTutorial ? 0x2ecc71 : 0x95a5a6, 1);
138+
checkboxBg.strokeRect(checkboxX, checkboxY, checkboxSize, checkboxSize);
139+
});
140+
98141
inputZone.on('pointerdown', () => {
99142
this.isInputActive = true;
100143
inputBoxBg.clear();
@@ -133,8 +176,8 @@ export class MenuScene extends Phaser.Scene {
133176
});
134177

135178
// Menu buttons
136-
const buttonY = 490;
137-
const buttonSpacing = 70;
179+
const buttonY = 510;
180+
const buttonSpacing = 60;
138181

139182
// Check if there's a saved game (not first time)
140183
const hasSavedGame = state.stats.totalRuns > 0;
@@ -239,8 +282,12 @@ export class MenuScene extends Phaser.Scene {
239282

240283
this.cameras.main.fadeOut(300, 0, 0, 0);
241284
this.cameras.main.once('camerafadeoutcomplete', () => {
242-
// Skip tutorial if already completed
243-
if (state.tutorialComplete) {
285+
// Skip tutorial if checkbox is checked or already completed
286+
if (this.skipTutorial || state.tutorialComplete) {
287+
// Mark tutorial as complete if skipping
288+
if (this.skipTutorial) {
289+
this.gameStateManager.setState({ tutorialComplete: true });
290+
}
244291
this.scene.start('HouseScene');
245292
} else {
246293
this.scene.start('TutorialScene');

0 commit comments

Comments
 (0)