2022-04-04 03:23:10 -04:00
|
|
|
import Vec2 from "../../Wolfie2D/DataTypes/Vec2";
|
2022-04-06 19:29:17 -04:00
|
|
|
import RandomMapGenerator from "../Tools/RandomMapGenerator";
|
2022-04-04 03:23:10 -04:00
|
|
|
import GameLevel from "./GameLevel";
|
2022-04-24 22:26:35 -04:00
|
|
|
import SnakeAI from "../AI/SnakeAI";
|
2022-04-23 21:17:43 -04:00
|
|
|
import Porcelain from "./Porcelain";
|
2022-04-25 21:20:49 -04:00
|
|
|
import InputWrapper from "../Tools/InputWrapper";
|
2022-04-04 03:23:10 -04:00
|
|
|
|
2022-04-13 19:43:16 -04:00
|
|
|
export default class Tutorial extends GameLevel {
|
2022-04-04 03:23:10 -04:00
|
|
|
loadScene(): void {
|
2022-04-08 18:01:21 -04:00
|
|
|
super.loadScene();
|
2022-04-25 21:20:49 -04:00
|
|
|
this.rmg = new RandomMapGenerator("shattered_sword_assets/jsons/forest_template.json", InputWrapper.randomSeed);
|
2022-04-13 18:56:35 -04:00
|
|
|
this.map = this.rmg.getMap();
|
2022-04-20 12:49:59 -04:00
|
|
|
this.load.tilemapFromObject("map", this.map);
|
2022-04-13 19:43:16 -04:00
|
|
|
|
2022-04-14 04:09:16 -04:00
|
|
|
//load enemies
|
2022-04-16 23:01:54 -04:00
|
|
|
this.load.spritesheet("Snake","shattered_sword_assets/spritesheets/Snake.json");
|
|
|
|
this.load.spritesheet("Tiger","shattered_sword_assets/spritesheets/Tiger.json");
|
2022-04-14 04:09:16 -04:00
|
|
|
|
2022-04-20 12:49:59 -04:00
|
|
|
//can load enemy sprite here
|
|
|
|
//sprites obtained from cse380 sprite wesbite
|
|
|
|
this.load.spritesheet("remus_werewolf","shattered_sword_assets/spritesheets/remus_werewolf.json");
|
|
|
|
this.load.spritesheet("black_pudding","shattered_sword_assets/spritesheets/black_pudding.json");
|
2022-04-09 04:49:30 -04:00
|
|
|
|
2022-04-04 03:23:10 -04:00
|
|
|
//load music here
|
|
|
|
}
|
2022-04-21 13:46:09 -04:00
|
|
|
|
|
|
|
updateScene(deltaT: number): void {
|
|
|
|
super.updateScene(deltaT);
|
|
|
|
|
|
|
|
//spawn snake()
|
2022-04-25 22:54:26 -04:00
|
|
|
if(Math.random() < .0001 && this.gameStarted){
|
2022-04-21 13:46:09 -04:00
|
|
|
console.log("RANDOM SNAKE!");
|
2022-04-24 22:26:35 -04:00
|
|
|
this.addEnemy("Snake", this.player.position.clone().add(new Vec2(0,-320)), SnakeAI, {
|
2022-04-21 13:46:09 -04:00
|
|
|
player: this.player,
|
|
|
|
health: 50,
|
|
|
|
tilemap: "Main",
|
2022-04-23 18:53:29 -04:00
|
|
|
size: new Vec2(14,10),
|
|
|
|
offset : new Vec2(0, 22),
|
2022-04-21 13:46:09 -04:00
|
|
|
exp: 50,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2022-04-23 21:17:43 -04:00
|
|
|
|
|
|
|
protected goToNextLevel(): void {
|
2022-04-23 21:48:12 -04:00
|
|
|
this.viewport.setZoomLevel(1);
|
2022-04-23 21:54:28 -04:00
|
|
|
this.sceneManager.changeToScene(Porcelain);
|
2022-04-23 21:17:43 -04:00
|
|
|
}
|
2022-04-25 23:17:59 -04:00
|
|
|
|
|
|
|
protected playStartStory(): void {
|
|
|
|
if (!this.touchedStartCheckPoint) {
|
|
|
|
this.touchedStartCheckPoint = true;
|
|
|
|
this.storyLoader("shattered_sword_assets/jsons/level1story.json");
|
|
|
|
this.startTimer();
|
|
|
|
}
|
|
|
|
}
|
2022-04-04 03:23:10 -04:00
|
|
|
}
|