feat: implement goToNextLevel(very buggy)

This commit is contained in:
Renge 2022-04-23 21:17:43 -04:00
parent 797d571b76
commit 5277697af6
3 changed files with 15 additions and 22 deletions

View File

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

View File

@ -22,9 +22,6 @@ export default class MainMenu extends Scene {
private control: Layer;
// private rmg: RandomMapGenerator;
animatedSprite: AnimatedSprite;
loadScene(): void {
// Load the menu song
//this.load.audio("menu", "shattered_sword_assets/music/menu.mp3");
@ -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

View File

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