From 52c9dc12995e25659b7eb5aac18fba9033c99fcd Mon Sep 17 00:00:00 2001 From: Renge Date: Mon, 9 May 2022 13:28:54 -0400 Subject: [PATCH] feat: added end level --- .../jsons/castle_template.json | 2 +- src/shattered_sword/Scenes/End.ts | 30 ++++--------------- src/shattered_sword/Scenes/GameLevel.ts | 1 + src/shattered_sword/Scenes/Market.ts | 3 +- 4 files changed, 10 insertions(+), 26 deletions(-) diff --git a/dist/shattered_sword_assets/jsons/castle_template.json b/dist/shattered_sword_assets/jsons/castle_template.json index ec3c079..1ec8946 100644 --- a/dist/shattered_sword_assets/jsons/castle_template.json +++ b/dist/shattered_sword_assets/jsons/castle_template.json @@ -29,7 +29,7 @@ { "type": "player", "x": 3, - "y": 13 + "y": 12.5 } ] }, diff --git a/src/shattered_sword/Scenes/End.ts b/src/shattered_sword/Scenes/End.ts index dcc9fb9..93abb91 100644 --- a/src/shattered_sword/Scenes/End.ts +++ b/src/shattered_sword/Scenes/End.ts @@ -3,6 +3,7 @@ import RandomMapGenerator from "../Tools/RandomMapGenerator"; import GameLevel from "./GameLevel"; import InputWrapper from "../Tools/InputWrapper"; import Forest from "./Forest"; +import GameFinish from "./GameFinish"; export default class End extends GameLevel { loadScene(): void { @@ -14,40 +15,21 @@ export default class End extends GameLevel { //load enemies } - updateScene(deltaT: number): void { - super.updateScene(deltaT); + startScene(): void { + super.startScene(); + this.addCheckPoint(new Vec2(3, 13), new Vec2(10, 10), "startStory", "nextLevel"); } protected goToNextLevel(): void { this.viewport.setZoomLevel(1); - let sceneOptions = { - physics: { - groupNames: ["ground", "player", "enemies"], - collisions: - [ - [0, 1, 1], - [1, 0, 0], - [1, 0, 0] - ] - } - } - this.sceneManager.changeToScene(Forest, {}, sceneOptions); + this.sceneManager.changeToScene(GameFinish); } protected playStartStory(): void { if (!this.touchedStartCheckPoint) { this.touchedStartCheckPoint = true; - this.storyLoader("shattered_sword_assetsshattered_sword_assets/jsons/level1story.json"); + this.storyLoader("shattered_sword_assets/jsons/level1story.json"); this.startTimer(); } } - - protected playEndStory() { - if (!this.touchedEndCheckPoint) { - this.touchedEndCheckPoint = true; - this.storyLoader("shattered_sword_assets/jsons/story.json"); - this.endTimer(); - this.levelEnded = true; - } - } } \ No newline at end of file diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 9eebaaa..3406fbd 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -395,6 +395,7 @@ export default class GameLevel extends Scene { this.startTimer(); break; case "nextLevel": + this.endTimer(); this.goToNextLevel(); break; } diff --git a/src/shattered_sword/Scenes/Market.ts b/src/shattered_sword/Scenes/Market.ts index d0efc33..6e65ca5 100644 --- a/src/shattered_sword/Scenes/Market.ts +++ b/src/shattered_sword/Scenes/Market.ts @@ -12,6 +12,7 @@ import AABB from "../../Wolfie2D/DataTypes/Shapes/AABB"; import EnemyAI from "../AI/EnemyAI"; import BattlerAI from "../AI/BattlerAI"; import InputWrapper from "../Tools/InputWrapper"; +import End from "./End"; export default class Market extends GameLevel { loadScene(): void { @@ -42,7 +43,7 @@ export default class Market extends GameLevel { ] } } - this.sceneManager.changeToScene(Market, {}, sceneOptions); + this.sceneManager.changeToScene(End, {}, sceneOptions); } protected playStartStory(): void {