diff --git a/chapter-8/example-1-areas/world.js b/chapter-8/example-1-areas/world.js index dab5623..d830396 100644 --- a/chapter-8/example-1-areas/world.js +++ b/chapter-8/example-1-areas/world.js @@ -13,7 +13,7 @@ const world = { }) }, create: function () { - let dg = new BSPDungeon(80, 50, 4) + let dg = new BSPDungeon(80, 50, 3) let level = dg.toLevelData() dungeon.initialize(this, level) diff --git a/chapter-8/example-2-rooms/bspdungeon.js b/chapter-8/example-2-rooms/bspdungeon.js index 02c0e3a..df2dbb8 100644 --- a/chapter-8/example-2-rooms/bspdungeon.js +++ b/chapter-8/example-2-rooms/bspdungeon.js @@ -44,12 +44,12 @@ class DArea { class DRoom { constructor(area) { - this.x = Math.floor(area.x + (Phaser.Math.Between(1, area.w) / 3)) - this.y = Math.floor(area.y + (Phaser.Math.Between(1, area.h) / 3)) - this.w = area.w - (this.x - area.x) - this.h = area.h - (this.y - area.y) - this.w -= Math.floor(Phaser.Math.Between(1, this.w / 3)) - this.h -= Math.floor(Phaser.Math.Between(1, this.h / 3)) + this.x = area.x+1 + this.y = area.y+1 + this.w = area.w-2 + this.h = area.h-2 + //this.w -= 1; //Math.floor(Phaser.Math.Between(1, this.w / 6)) + //this.h -= 1; //Math.floor(Phaser.Math.Between(1, this.h / 3)) } } diff --git a/chapter-8/example-3-corridors/bspdungeon.js b/chapter-8/example-3-corridors/bspdungeon.js index 476910f..ba4ec98 100644 --- a/chapter-8/example-3-corridors/bspdungeon.js +++ b/chapter-8/example-3-corridors/bspdungeon.js @@ -44,12 +44,16 @@ class DArea { class DRoom { constructor(area) { - this.x = Math.floor(area.x + (Phaser.Math.Between(1, area.w) / 3)) + /* this.x = Math.floor(area.x + (Phaser.Math.Between(1, area.w) / 3)) this.y = Math.floor(area.y + (Phaser.Math.Between(1, area.h) / 3)) this.w = area.w - (this.x - area.x) this.h = area.h - (this.y - area.y) this.w -= Math.floor(Phaser.Math.Between(1, this.w / 3)) this.h -= Math.floor(Phaser.Math.Between(1, this.h / 3)) + */this.x = area.x+1 + this.y = area.y+1 + this.w = area.w-2 + this.h = area.h-2 } }