Skip to content

Commit 46cd03c

Browse files
committed
Fix tutorial completion to properly advance game progression
- Added tutorialComplete flag to GameState - TutorialScene now marks tutorial as complete and goes to HouseScene - MenuScene checks tutorialComplete to skip tutorial if already done - This fixes the loop where completing tutorial would restart it
1 parent 78c3f64 commit 46cd03c

10 files changed

Lines changed: 1190 additions & 7534 deletions

File tree

dist/assets/index-CMZMq4tb.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1165 additions & 1165 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/index-Cq8ADPXp.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/phaser-0RJB29YE-DPEdKycn.js

Lines changed: 0 additions & 6361 deletions
This file was deleted.

dist/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
display: block;
3131
}
3232
</style>
33-
<link rel="modulepreload" crossorigin href="./assets/phaser-0RJB29YE-DPEdKycn.js">
34-
<script type="module" crossorigin src="./assets/index-CMZMq4tb.js"></script>
33+
<link rel="modulepreload" crossorigin href="data:text/javascript;base64,Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPXBoYXNlci1sMHNOUk5LWi5qcy5tYXAK">
34+
<script type="module" crossorigin src="./assets/index-Cq8ADPXp.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-CMZMq4tb.js"></script>
33+
<script type="module" crossorigin src="./dist/assets/index-Cq8ADPXp.js"></script>
3434
<link rel="modulepreload" crossorigin href="./dist/assets/phaser-l0sNRNKZ.js">
3535
</head>
3636
<body>

src/scenes/MenuScene.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,16 @@ export class MenuScene extends Phaser.Scene {
235235
}
236236

237237
private startNewGame(): void {
238+
const state = this.gameStateManager.getState();
239+
238240
this.cameras.main.fadeOut(300, 0, 0, 0);
239241
this.cameras.main.once('camerafadeoutcomplete', () => {
240-
this.scene.start('TutorialScene');
242+
// Skip tutorial if already completed
243+
if (state.tutorialComplete) {
244+
this.scene.start('HouseScene');
245+
} else {
246+
this.scene.start('TutorialScene');
247+
}
241248
});
242249
}
243250

src/scenes/TutorialScene.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Phaser from 'phaser';
2+
import { GameStateManager } from '../utils/GameStateManager';
23

34
export class TutorialScene extends Phaser.Scene {
5+
private gameStateManager!: GameStateManager;
46
private player!: Phaser.Physics.Arcade.Sprite;
57
private grandpa!: Phaser.Physics.Arcade.Sprite;
68
private cursors!: Phaser.Types.Input.Keyboard.CursorKeys;
@@ -38,6 +40,9 @@ export class TutorialScene extends Phaser.Scene {
3840
}
3941

4042
create(): void {
43+
// Initialize game state manager
44+
this.gameStateManager = GameStateManager.getInstance();
45+
4146
// Set world bounds for the small tutorial hill
4247
this.physics.world.setBounds(0, 0, 800, 600);
4348

@@ -378,11 +383,14 @@ export class TutorialScene extends Phaser.Scene {
378383
}
379384

380385
private completeTutorial(): void {
381-
// Fade out and transition to menu/house scene
386+
// Mark tutorial as complete (setState automatically saves)
387+
this.gameStateManager.setState({ tutorialComplete: true });
388+
389+
// Fade out and transition to house scene
382390
this.cameras.main.fadeOut(1500, 0, 0, 0);
383391
this.cameras.main.once('camerafadeoutcomplete', () => {
384-
// Transition to HouseScene (or MenuScene if HouseScene doesn't exist)
385-
this.scene.start('MenuScene');
392+
// Transition to HouseScene to start the real game
393+
this.scene.start('HouseScene');
386394
});
387395
}
388396
}

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface GameState {
66
playerPosition: { x: number; y: number; layer: number };
77
mountainSeed: string;
88
currentDay: number;
9+
tutorialComplete: boolean;
910
upgrades: UpgradeState;
1011
stats: GameStats;
1112
newGamePlus: NewGamePlusState;

src/utils/GameStateManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export class GameStateManager {
2525
playerPosition: { x: 640, y: 600, layer: 0 },
2626
mountainSeed: this.generateSeed(),
2727
currentDay: 1,
28+
tutorialComplete: false,
2829
upgrades: this.getDefaultUpgrades(),
2930
stats: this.getDefaultStats(),
3031
newGamePlus: this.getDefaultNewGamePlus(),

0 commit comments

Comments
 (0)