feat: added end level

This commit is contained in:
Renge 2022-05-09 13:28:54 -04:00
parent 5502255b7e
commit 52c9dc1299
4 changed files with 10 additions and 26 deletions

View File

@ -29,7 +29,7 @@
{
"type": "player",
"x": 3,
"y": 13
"y": 12.5
}
]
},

View File

@ -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;
}
}
}

View File

@ -395,6 +395,7 @@ export default class GameLevel extends Scene {
this.startTimer();
break;
case "nextLevel":
this.endTimer();
this.goToNextLevel();
break;
}

View File

@ -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 {