From 52b8f925ebd69b6e8e11430d8a0e5aec5f1428b7 Mon Sep 17 00:00:00 2001 From: Renge Date: Sat, 7 May 2022 20:19:22 -0400 Subject: [PATCH] feat: porcelain_template triggers --- .../jsons/porcelain_template.json | 7 +++--- src/shattered_sword/Scenes/GameLevel.ts | 2 +- src/shattered_sword/Scenes/Porcelain.ts | 24 +++++++++++++++++++ src/shattered_sword/Scenes/Tutorial.ts | 13 +++++++++- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/dist/shattered_sword_assets/jsons/porcelain_template.json b/dist/shattered_sword_assets/jsons/porcelain_template.json index e50b670..ad02e34 100644 --- a/dist/shattered_sword_assets/jsons/porcelain_template.json +++ b/dist/shattered_sword_assets/jsons/porcelain_template.json @@ -47,8 +47,8 @@ "y": 7, "possibility": 1 } - ] - + ], + "startCheckPoint": [24, 13, 4, 4] }, "exit": { "width": 30, @@ -72,7 +72,8 @@ "width": 4, "alt_tile": [11, 11] } - ] + ], + "endCheckPoint": [20, 17, 10, 6] }, "rooms": [ { diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 1b41f8a..50db651 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -24,7 +24,7 @@ import SnakeAI from "../AI/SnakeAI"; import SlimeAI from "../AI/SlimeAI"; import TigerAI from "../AI/TigerAI"; import ArcherAI from "../AI/ArcherAI"; -import AssassinAI from "../AI/AssassinAi"; +import AssassinAI from "../AI/AssassinAI"; import BattlerAI from "../AI/BattlerAI"; import InventoryManager from "../GameSystems/InventoryManager"; import Item from "../GameSystems/items/Item"; diff --git a/src/shattered_sword/Scenes/Porcelain.ts b/src/shattered_sword/Scenes/Porcelain.ts index 11d3945..c2258f0 100644 --- a/src/shattered_sword/Scenes/Porcelain.ts +++ b/src/shattered_sword/Scenes/Porcelain.ts @@ -12,6 +12,7 @@ import AABB from "../../Wolfie2D/DataTypes/Shapes/AABB"; import EnemyAI from "../AI/EnemyAI"; import BattlerAI from "../AI/BattlerAI"; import InputWrapper from "../Tools/InputWrapper"; +import Greatwall from "./Greatwall"; export default class Porcelain extends GameLevel { loadScene(): void { @@ -33,4 +34,27 @@ export default class Porcelain extends GameLevel { //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(); + } + } } \ No newline at end of file diff --git a/src/shattered_sword/Scenes/Tutorial.ts b/src/shattered_sword/Scenes/Tutorial.ts index 99e9a83..633395c 100644 --- a/src/shattered_sword/Scenes/Tutorial.ts +++ b/src/shattered_sword/Scenes/Tutorial.ts @@ -42,7 +42,18 @@ export default class Tutorial extends GameLevel { protected goToNextLevel(): void { this.viewport.setZoomLevel(1); - this.sceneManager.changeToScene(Porcelain); + 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 {