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,15 +357,17 @@ 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 {
let tmp = new Enemy(); if (this.gen.random() <= sprite.possibility) {
tmp.type = sprite.type; let tmp = new Enemy();
tmp.position = new Vec2(posX + sprite.x, posY + sprite.y); tmp.type = sprite.type;
room.enemies.push(tmp); tmp.position = new Vec2(posX + sprite.x, posY + sprite.y);
room.enemies.push(tmp);
}
} }
} }
} }