fix: rename Tutorial to Forest, fix player position; Feat: trigger for Greatwall

This commit is contained in:
Renge 2022-05-07 20:37:21 -04:00
parent 07ec324abf
commit fd0977079e
8 changed files with 50 additions and 79 deletions

View File

@ -37,7 +37,7 @@
{ {
"type": "player", "type": "player",
"x": 5, "x": 5,
"y": 19 "y": 17
} }
], ],
"startCheckPoint": [15, 15, 15, 15] "startCheckPoint": [15, 15, 15, 15]

View File

@ -29,10 +29,10 @@
{ {
"type": "player", "type": "player",
"x": 5, "x": 5,
"y": 11 "y": 9
} }
] ],
"startCheckPoint": [30, 7, 1, 12]
}, },
"exit": { "exit": {
"width": 33, "width": 33,
@ -52,7 +52,8 @@
"width": 3, "width": 3,
"alt_tile": [0, 5] "alt_tile": [0, 5]
} }
] ],
"endCheckPoint": [30, 7, 1, 12]
}, },
"rooms": [ "rooms": [
{ {

View File

@ -39,7 +39,7 @@
{ {
"type": "player", "type": "player",
"x": 5, "x": 5,
"y": 10 "y": 8
}, },
{ {
"type": "Tiger", "type": "Tiger",

View File

@ -40,11 +40,6 @@ import Sprite from "../../Wolfie2D/Nodes/Sprites/Sprite";
import TextInput from "../../Wolfie2D/Nodes/UIElements/TextInput"; import TextInput from "../../Wolfie2D/Nodes/UIElements/TextInput";
import { TiledTilemapData } from "../../Wolfie2D/DataTypes/Tilesets/TiledData"; import { TiledTilemapData } from "../../Wolfie2D/DataTypes/Tilesets/TiledData";
import GameOver from "./GameOver"; import GameOver from "./GameOver";
import Porcelain from "./Porcelain";
import Tutorial from "./Tutorial";
import Greatwall from "./Greatwall";
import Snow from "./Snow";
import Market from "./Market";
import MainMenu from "./MainMenu"; import MainMenu from "./MainMenu";
// TODO // TODO

View File

@ -29,4 +29,36 @@ export default class Greatwall extends GameLevel {
//load music here //load music here
} }
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(Greatwall, {}, sceneOptions);
}
protected playStartStory(): void {
if (!this.touchedStartCheckPoint) {
this.touchedStartCheckPoint = true;
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

@ -11,7 +11,7 @@ import Color from "../../Wolfie2D/Utils/Color";
import Layer from "../../Wolfie2D/Scene/Layer"; import Layer from "../../Wolfie2D/Scene/Layer";
import Label from "../../Wolfie2D/Nodes/UIElements/Label"; import Label from "../../Wolfie2D/Nodes/UIElements/Label";
import MainMenu from "./MainMenu"; import MainMenu from "./MainMenu";
import Tutorial from "./Tutorial"; import Forest from "./Forest";
import Porcelain from "./Porcelain"; import Porcelain from "./Porcelain";
import Greatwall from './Greatwall'; import Greatwall from './Greatwall';
import Snow from './Snow'; import Snow from './Snow';
@ -114,7 +114,7 @@ export default class Levels extends Scene {
] ]
} }
} }
this.sceneManager.changeToScene(Tutorial, {}, sceneOptions); this.sceneManager.changeToScene(Forest, {}, sceneOptions);
} }
if(event.type === "porcelain"){ if(event.type === "porcelain"){

View File

@ -57,4 +57,13 @@ export default class Porcelain extends GameLevel {
this.startTimer(); 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

@ -1,66 +0,0 @@
import Vec2 from "../../Wolfie2D/DataTypes/Vec2";
import RandomMapGenerator from "../Tools/RandomMapGenerator";
import GameLevel from "./GameLevel";
import SnakeAI from "../AI/SnakeAI";
import Porcelain from "./Porcelain";
import InputWrapper from "../Tools/InputWrapper";
export default class Tutorial extends GameLevel {
loadScene(): void {
super.loadScene();
this.rmg = new RandomMapGenerator("shattered_sword_assets/jsons/forest_template.json", InputWrapper.randomSeed);
this.map = this.rmg.getMap();
this.load.tilemapFromObject("map", this.map);
//load enemies
this.load.spritesheet("Snake","shattered_sword_assets/spritesheets/Snake.json");
//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");
//load music here
}
updateScene(deltaT: number): void {
super.updateScene(deltaT);
//spawn snake()
if(Math.random() < .0001 && this.gameStarted){
console.log("RANDOM SNAKE!");
this.addEnemy("Snake", this.player.position.clone().add(new Vec2(0,-320)), SnakeAI, {
player: this.player,
health: 50,
tilemap: "Main",
size: new Vec2(14,10),
offset : new Vec2(0, 22),
exp: 50,
})
}
}
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(Porcelain, {}, sceneOptions);
}
protected playStartStory(): void {
if (!this.touchedStartCheckPoint) {
this.touchedStartCheckPoint = true;
this.storyLoader("shattered_sword_assets/jsons/level1story.json");
this.startTimer();
}
}
}