feat: add end
This commit is contained in:
parent
357991d626
commit
5da79c3bf0
53
src/shattered_sword/Scenes/End.ts
Normal file
53
src/shattered_sword/Scenes/End.ts
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
import Vec2 from "../../Wolfie2D/DataTypes/Vec2";
|
||||||
|
import RandomMapGenerator from "../Tools/RandomMapGenerator";
|
||||||
|
import GameLevel from "./GameLevel";
|
||||||
|
import InputWrapper from "../Tools/InputWrapper";
|
||||||
|
import Forest from "./Forest";
|
||||||
|
|
||||||
|
export default class End extends GameLevel {
|
||||||
|
loadScene(): void {
|
||||||
|
super.loadScene();
|
||||||
|
this.rmg = new RandomMapGenerator("shattered_sword_assets/jsons/castle_template.json", InputWrapper.randomSeed);
|
||||||
|
this.map = this.rmg.getMap();
|
||||||
|
this.load.tilemapFromObject("map", this.map);
|
||||||
|
|
||||||
|
//load enemies
|
||||||
|
}
|
||||||
|
|
||||||
|
updateScene(deltaT: number): void {
|
||||||
|
super.updateScene(deltaT);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected playStartStory(): void {
|
||||||
|
if (!this.touchedStartCheckPoint) {
|
||||||
|
this.touchedStartCheckPoint = true;
|
||||||
|
this.storyLoader("shattered_sword_assetsshattered_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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import Porcelain from "./Porcelain";
|
||||||
import Greatwall from './Greatwall';
|
import Greatwall from './Greatwall';
|
||||||
import Snow from './Snow';
|
import Snow from './Snow';
|
||||||
import Market from './Market';
|
import Market from './Market';
|
||||||
|
import End from './End'
|
||||||
import InputWrapper from "../Tools/InputWrapper";
|
import InputWrapper from "../Tools/InputWrapper";
|
||||||
import TextInput from "../../Wolfie2D/Nodes/UIElements/TextInput";
|
import TextInput from "../../Wolfie2D/Nodes/UIElements/TextInput";
|
||||||
|
|
||||||
|
@ -243,6 +244,28 @@ export default class Levels extends Scene {
|
||||||
this.sceneManager.changeToScene(Market, {}, sceneOptions);
|
this.sceneManager.changeToScene(Market, {}, sceneOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(event.type === "end"){
|
||||||
|
if (this.seedInput.text) {
|
||||||
|
InputWrapper.randomSeed = this.seedInput.text;
|
||||||
|
this.seedInput.text = "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
InputWrapper.randomSeed = Math.floor(Math.random() * 10000000000).toString();
|
||||||
|
}
|
||||||
|
let sceneOptions = {
|
||||||
|
physics: {
|
||||||
|
groupNames: ["ground", "player", "enemies"],
|
||||||
|
collisions:
|
||||||
|
[
|
||||||
|
[0, 1, 1],
|
||||||
|
[1, 0, 0],
|
||||||
|
[1, 0, 0]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.sceneManager.changeToScene(End, {}, sceneOptions);
|
||||||
|
}
|
||||||
|
|
||||||
if(event.type === "back"){
|
if(event.type === "back"){
|
||||||
this.sceneManager.changeToScene(MainMenu, {});
|
this.sceneManager.changeToScene(MainMenu, {});
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,6 @@ export default class Start extends GameLevel {
|
||||||
//load enemies
|
//load enemies
|
||||||
}
|
}
|
||||||
|
|
||||||
updateScene(deltaT: number): void {
|
|
||||||
super.updateScene(deltaT);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected goToNextLevel(): void {
|
protected goToNextLevel(): void {
|
||||||
this.viewport.setZoomLevel(1);
|
this.viewport.setZoomLevel(1);
|
||||||
let sceneOptions = {
|
let sceneOptions = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user