From 3beaf76980fcf7dc212dea74dfe7bd2716e796f5 Mon Sep 17 00:00:00 2001 From: Renge Date: Wed, 13 Apr 2022 15:25:42 -0400 Subject: [PATCH] fix: wrong position in RMG --- src/shattered_sword/Scenes/Tutorial.ts | 2 +- src/shattered_sword/Tools/RandomMapGenerator.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shattered_sword/Scenes/Tutorial.ts b/src/shattered_sword/Scenes/Tutorial.ts index 1535d24..de69740 100644 --- a/src/shattered_sword/Scenes/Tutorial.ts +++ b/src/shattered_sword/Scenes/Tutorial.ts @@ -39,7 +39,7 @@ export default class Tutorial extends GameLevel{ this.viewport.setBounds(0, -500, this.map.width*32, this.map.height*32); this.viewport.follow(this.player); - this.playerSpawn = new Vec2(5*32, 9*32); + this.playerSpawn = new Vec2(1*32, 1*32); // Do generic setup for a GameLevel super.startScene(); diff --git a/src/shattered_sword/Tools/RandomMapGenerator.ts b/src/shattered_sword/Tools/RandomMapGenerator.ts index 940561a..79a7809 100644 --- a/src/shattered_sword/Tools/RandomMapGenerator.ts +++ b/src/shattered_sword/Tools/RandomMapGenerator.ts @@ -250,6 +250,10 @@ export default class RandomMapGenerator { for (let room of this.rooms) { let roomWidth = room.bottomRight.x - room.topLeft.x + 1; let roomHeight = room.bottomRight.y - room.topLeft.y + 1; + room.topLeft.x -= this.minX; + room.topLeft.y -= this.minY; + room.bottomRight.x -= this.minX; + room.bottomRight.y -= this.minY; for (let i = 0; i < roomHeight; i++) for (let j = 0; j < roomWidth; j++) { this.map.layers[0].data[(room.topLeft.y + i) * width + room.topLeft.x + j] = room.bottomLayer[i * roomWidth + j];