mirror of
https://github.com/tiennm99/nntv.git
synced 2026-09-20 04:23:37 +00:00
fix: reset game state flags in init() so input works on level transitions
Phaser constructor only runs once; init() runs on every scene.start(). handleLevelComplete() was setting isPaused=true/inputEnabled=false which persisted into subsequent levels, freezing player input.
This commit is contained in:
1 parent
35d3f45d6f
commit
4461e45502
1 file changed
+8
-1
@@ -32,9 +32,16 @@ export class Game extends Phaser.Scene {
|
||||
}
|
||||
|
||||
init(data) {
|
||||
// Initialize with data passed from previous scene
|
||||
this.currentLevel = data.level || 1;
|
||||
this.livesRemaining = data.lives || 3;
|
||||
// Reset state flags (constructor only runs once in Phaser)
|
||||
this.inputEnabled = true;
|
||||
this.isPaused = false;
|
||||
this.isFinalLevel = false;
|
||||
this.inputCooldown = 0;
|
||||
this.guards = [];
|
||||
this.detectionPopup = null;
|
||||
this.finalLevelMessage = null;
|
||||
}
|
||||
|
||||
create() {
|
||||
|
||||
Reference in new issue
Block a user