diff --git a/dist/shattered_sword_assets/jsons/greatwall_template.json b/dist/shattered_sword_assets/jsons/greatwall_template.json index c0020a7..189e9ec 100644 --- a/dist/shattered_sword_assets/jsons/greatwall_template.json +++ b/dist/shattered_sword_assets/jsons/greatwall_template.json @@ -16,7 +16,7 @@ "width": 30, "height": 20, "bottomLayer": [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16], - "topLayer": [0, 0, 0, 0, 0, 0, 13, 6, 3, 2, 13, 3, 6, 11, 2, 13, 0, 0, 0, 0, 0, 0, 0, 0,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, 5, 5, 5, 5, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], "entrances": [ { "x": 29, @@ -128,18 +128,18 @@ } ], "entrances": [ - { - "x": 31, - "y": 19, - "width": 4, - "alt_tile": [5, 5] - }, { "x": 65, "y": 15, "width": 3, "alt_tile": [16, 5] }, + { + "x": 31, + "y": 19, + "width": 4, + "alt_tile": [5, 5] + }, { "x": 65, "y": 9, diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 8df4123..9f65162 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -38,6 +38,7 @@ import { TiledTilemapData } from "../../Wolfie2D/DataTypes/Tilesets/TiledData"; import GameOver from "./GameOver"; import Porcelain from "./Porcelain"; import Tutorial from "./Tutorial"; +import Greatwall from "./Greatwall"; // TODO /** diff --git a/src/shattered_sword/Scenes/Greatwall.ts b/src/shattered_sword/Scenes/Greatwall.ts new file mode 100644 index 0000000..cec7676 --- /dev/null +++ b/src/shattered_sword/Scenes/Greatwall.ts @@ -0,0 +1,31 @@ +import { TiledTilemapData } from "../../Wolfie2D/DataTypes/Tilesets/TiledData"; +import Vec2 from "../../Wolfie2D/DataTypes/Vec2"; +import Debug from "../../Wolfie2D/Debug/Debug"; +import { GameEventType } from "../../Wolfie2D/Events/GameEventType"; +import RandomMapGenerator from "../Tools/RandomMapGenerator"; +import GameLevel from "./GameLevel"; +import Label from "../../Wolfie2D/Nodes/UIElements/Label"; +import Color from "../../Wolfie2D/Utils/Color"; +import { UIElementType } from "../../Wolfie2D/Nodes/UIElements/UIElementTypes"; +import { Statuses } from "../sword_enums"; +import AABB from "../../Wolfie2D/DataTypes/Shapes/AABB"; +import EnemyAI from "../AI/EnemyAI"; +import BattlerAI from "../AI/BattlerAI"; + +export default class Greatwall extends GameLevel { + loadScene(): void { + super.loadScene(); + this.rmg = new RandomMapGenerator("shattered_sword_assets/jsons/greatwall_template.json", this.randomSeed); + this.map = this.rmg.getMap(); + console.log(this.map); + this.load.tilemapFromObject("map", this.map); + + //load enemies + + //can load enemy sprite here + //sprites obtained from cse380 sprite wesbite + // this.load.spritesheet("black_pudding","shattered_sword_assets/spritesheets/black_pudding.json"); + + //load music here + } +} \ No newline at end of file diff --git a/src/shattered_sword/Scenes/Levels.ts b/src/shattered_sword/Scenes/Levels.ts index 8ee196e..e340ee2 100644 --- a/src/shattered_sword/Scenes/Levels.ts +++ b/src/shattered_sword/Scenes/Levels.ts @@ -12,7 +12,8 @@ import Layer from "../../Wolfie2D/Scene/Layer"; import Label from "../../Wolfie2D/Nodes/UIElements/Label"; import MainMenu from "./MainMenu"; import Tutorial from "./Tutorial"; -import Porcelain from "./Porcelain" +import Porcelain from "./Porcelain"; +import Greatwall from './Greatwall'; export default class Levels extends Scene { @@ -40,7 +41,14 @@ export default class Levels extends Scene { porcelain.backgroundColor = Color.TRANSPARENT; porcelain.onClickEventId = "porcelain"; - const back = this.add.uiElement(UIElementType.BUTTON, "primary", {position: new Vec2(center.x, center.y + 50), text: "Back"}); + const greatwall = this.add.uiElement(UIElementType.BUTTON, "primary", {position: new Vec2(center.x, center.y + 50), text: "greatwall"}); + greatwall.size.set(200, 50); + greatwall.borderWidth = 2; + greatwall.borderColor = Color.WHITE; + greatwall.backgroundColor = Color.TRANSPARENT; + greatwall.onClickEventId = "greatwall"; + + const back = this.add.uiElement(UIElementType.BUTTON, "primary", {position: new Vec2(center.x, center.y + 100), text: "Back"}); back.size.set(200, 50); back.borderWidth = 2; back.borderColor = Color.WHITE; @@ -49,6 +57,7 @@ export default class Levels extends Scene { this.receiver.subscribe("tutorial"); this.receiver.subscribe("porcelain"); + this.receiver.subscribe("greatwall"); this.receiver.subscribe("back"); } @@ -88,6 +97,22 @@ export default class Levels extends Scene { } this.sceneManager.changeToScene(Porcelain, {}, sceneOptions); } + + if(event.type === "greatwall"){ + let sceneOptions = { + physics: { + groupNames: ["ground", "player", "enemies"], + collisions: + [ + [0, 1, 1], + [1, 0, 0], + [1, 0, 0] + ] + } + } + this.sceneManager.changeToScene(Greatwall, {}, sceneOptions); + } + if(event.type === "back"){ this.sceneManager.changeToScene(MainMenu, {}); }