fix: wrong position in RMG
This commit is contained in:
parent
52278cb456
commit
3beaf76980
|
@ -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.setBounds(0, -500, this.map.width*32, this.map.height*32);
|
||||||
this.viewport.follow(this.player);
|
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
|
// Do generic setup for a GameLevel
|
||||||
super.startScene();
|
super.startScene();
|
||||||
|
|
|
@ -250,6 +250,10 @@ export default class RandomMapGenerator {
|
||||||
for (let room of this.rooms) {
|
for (let room of this.rooms) {
|
||||||
let roomWidth = room.bottomRight.x - room.topLeft.x + 1;
|
let roomWidth = room.bottomRight.x - room.topLeft.x + 1;
|
||||||
let roomHeight = room.bottomRight.y - room.topLeft.y + 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 i = 0; i < roomHeight; i++)
|
||||||
for (let j = 0; j < roomWidth; j++) {
|
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];
|
this.map.layers[0].data[(room.topLeft.y + i) * width + room.topLeft.x + j] = room.bottomLayer[i * roomWidth + j];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user