fix: fix some bugs in prev commit
This commit is contained in:
parent
9aa1495dd0
commit
faeec383ba
|
@ -357,11 +357,12 @@ export default class RandomMapGenerator {
|
||||||
if (old.sprites) {
|
if (old.sprites) {
|
||||||
for (let index = 0; index < old.sprites.length; index++) {
|
for (let index = 0; index < old.sprites.length; index++) {
|
||||||
const sprite = old.sprites[index];
|
const sprite = old.sprites[index];
|
||||||
if (sprite.type == 'player') {
|
if (sprite.type === 'player') {
|
||||||
this.player.x = sprite.x;
|
this.player.x = sprite.x;
|
||||||
this.player.y = sprite.y;
|
this.player.y = sprite.y;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (this.gen.random() <= sprite.possibility) {
|
||||||
let tmp = new Enemy();
|
let tmp = new Enemy();
|
||||||
tmp.type = sprite.type;
|
tmp.type = sprite.type;
|
||||||
tmp.position = new Vec2(posX + sprite.x, posY + sprite.y);
|
tmp.position = new Vec2(posX + sprite.x, posY + sprite.y);
|
||||||
|
@ -369,6 +370,7 @@ export default class RandomMapGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (posX < this.minX)
|
if (posX < this.minX)
|
||||||
this.minX = posX;
|
this.minX = posX;
|
||||||
if (posY < this.minY)
|
if (posY < this.minY)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user