feat: add start level and make it the first level

This commit is contained in:
Renge 2022-05-09 13:19:58 -04:00
parent 5da79c3bf0
commit 123688a467
4 changed files with 8 additions and 12 deletions

View File

@ -28,7 +28,7 @@
"sprites": [ "sprites": [
{ {
"type": "player", "type": "player",
"x": 1, "x": 3,
"y": 13 "y": 13
} }
] ]

View File

@ -269,8 +269,6 @@ export default class Levels extends Scene {
if(event.type === "back"){ if(event.type === "back"){
this.sceneManager.changeToScene(MainMenu, {}); this.sceneManager.changeToScene(MainMenu, {});
} }
} }
} }

View File

@ -15,6 +15,7 @@ import GameLevel from "./GameLevel";
import InputWrapper from "../Tools/InputWrapper"; import InputWrapper from "../Tools/InputWrapper";
import TextInput from "../../Wolfie2D/Nodes/UIElements/TextInput"; import TextInput from "../../Wolfie2D/Nodes/UIElements/TextInput";
import Forest from "./Forest"; import Forest from "./Forest";
import Start from "./Start";
export default class MainMenu extends Scene { export default class MainMenu extends Scene {
protected config: ConfigManager; protected config: ConfigManager;
@ -194,7 +195,7 @@ export default class MainMenu extends Scene {
] ]
} }
} }
this.sceneManager.changeToScene(Forest, {}, sceneOptions); this.sceneManager.changeToScene(Start, {}, sceneOptions);
} }
} }

View File

@ -14,6 +14,11 @@ export default class Start extends GameLevel {
//load enemies //load enemies
} }
startScene(): void {
super.startScene();
this.addCheckPoint(new Vec2(3, 13), new Vec2(10, 10), "endStory", "nextLevel");
}
protected goToNextLevel(): void { protected goToNextLevel(): void {
this.viewport.setZoomLevel(1); this.viewport.setZoomLevel(1);
let sceneOptions = { let sceneOptions = {
@ -30,14 +35,6 @@ export default class Start extends GameLevel {
this.sceneManager.changeToScene(Forest, {}, sceneOptions); this.sceneManager.changeToScene(Forest, {}, sceneOptions);
} }
protected playStartStory(): void {
if (!this.touchedStartCheckPoint) {
this.touchedStartCheckPoint = true;
this.storyLoader("shattered_sword_assets/jsons/level1story.json");
this.startTimer();
}
}
protected playEndStory() { protected playEndStory() {
if (!this.touchedEndCheckPoint) { if (!this.touchedEndCheckPoint) {
this.touchedEndCheckPoint = true; this.touchedEndCheckPoint = true;