fix: fix some bugs in prev commit

This commit is contained in:
Renge 2022-04-10 19:50:14 -04:00
parent 9aa1495dd0
commit faeec383ba

View File

@ -357,11 +357,12 @@ export default class RandomMapGenerator {
if (old.sprites) {
for (let index = 0; index < old.sprites.length; index++) {
const sprite = old.sprites[index];
if (sprite.type == 'player') {
if (sprite.type === 'player') {
this.player.x = sprite.x;
this.player.y = sprite.y;
}
else {
if (this.gen.random() <= sprite.possibility) {
let tmp = new Enemy();
tmp.type = sprite.type;
tmp.position = new Vec2(posX + sprite.x, posY + sprite.y);
@ -369,6 +370,7 @@ export default class RandomMapGenerator {
}
}
}
}
if (posX < this.minX)
this.minX = posX;
if (posY < this.minY)