diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 224d0e5..25110cd 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -39,6 +39,8 @@ import { TiledTilemapData } from "../../Wolfie2D/DataTypes/Tilesets/TiledData"; import AttackAction from "../AI/EnemyActions/AttackAction"; import Move from "../AI/EnemyActions/Move"; import GameOver from "./GameOver"; +import Porcelain from "./Porcelain"; +import Tutorial from "./Tutorial"; // TODO /** @@ -136,6 +138,7 @@ export default class GameLevel extends Scene { protected static gameTimer: number = 0; protected gameStarted: boolean = false; protected timerLable: Label; + protected levelEnded: boolean = false; startpos: Vec2; loadScene(): void { @@ -1072,6 +1075,7 @@ export default class GameLevel extends Scene { this.touchedStartCheckPoint = true; this.storyLoader("shattered_sword_assets/jsons/story.json"); this.startTimer(); + this.levelEnded = true; } } @@ -1080,6 +1084,7 @@ export default class GameLevel extends Scene { this.touchedEndCheckPoint = true; this.storyLoader("shattered_sword_assets/jsons/story.json"); this.endTimer(); + this.levelEnded = true; } } @@ -1092,7 +1097,7 @@ export default class GameLevel extends Scene { } protected goToNextLevel() { - console.log("goToNextLevel") + // this.sceneManager.changeToScene(Porcelain); } @@ -1210,6 +1215,9 @@ export default class GameLevel extends Scene { this.story = undefined; this.storytextLabel = undefined; // this.storyLayer = undefined; + if (this.levelEnded) { + this.goToNextLevel(); + } } } diff --git a/src/shattered_sword/Scenes/MainMenu.ts b/src/shattered_sword/Scenes/MainMenu.ts index 6bf0298..6f8df29 100644 --- a/src/shattered_sword/Scenes/MainMenu.ts +++ b/src/shattered_sword/Scenes/MainMenu.ts @@ -21,9 +21,6 @@ export default class MainMenu extends Scene { private about: Layer; private control: Layer; // private rmg: RandomMapGenerator; - - - animatedSprite: AnimatedSprite; loadScene(): void { // Load the menu song @@ -33,24 +30,6 @@ export default class MainMenu extends Scene { //TODO startScene(): void{ - // this.config = new ConfigManager(); - // this.save = new SaveManager(); - // console.log(this.config.getVolume()); - // this.config.setVolume(100); - // console.log(this.config.getVolume()); - // console.log(this.save.getLevel()); - // this.save.setLevel(10); - - // console.log(this.save.getLevel()); - - // this.rmg = new RandomMapGenerator("shattered_sword_assets/jsons/forest_template.json", 114514); - // this.rmg.getMap(); - - - - // Scene has started, so start playing music - //this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "menu", loop: true, holdReference: true}); - const center = this.viewport.getCenter(); // The main menu diff --git a/src/shattered_sword/Scenes/Tutorial.ts b/src/shattered_sword/Scenes/Tutorial.ts index 4a93155..ceb2eb8 100644 --- a/src/shattered_sword/Scenes/Tutorial.ts +++ b/src/shattered_sword/Scenes/Tutorial.ts @@ -13,6 +13,8 @@ import EnemyAI from "../AI/EnemyAI"; import BattlerAI from "../AI/BattlerAI"; import AttackAction from "../AI/EnemyActions/AttackAction"; import Move from "../AI/EnemyActions/Move"; +import Porcelain from "./Porcelain"; +import MainMenu from "./MainMenu"; export default class Tutorial extends GameLevel { loadScene(): void { @@ -54,4 +56,8 @@ export default class Tutorial extends GameLevel { }) } } + + protected goToNextLevel(): void { + this.sceneManager.changeToScene(MainMenu); + } } \ No newline at end of file