fix: bug in getEnemies

This commit is contained in:
Renge 2022-04-13 19:37:26 -04:00
parent d53b8ce4d3
commit 75ce98f947
3 changed files with 8 additions and 2 deletions

View File

@ -28,6 +28,12 @@
"type": "player",
"x": 5,
"y": 19
},
{
"type": "test_dummy",
"x": 7,
"y": 19,
"possibility": 1
}
]
},

View File

@ -40,7 +40,7 @@ export default class Tutorial extends GameLevel{
this.viewport.setBounds(0, 0, this.map.width*32, this.map.height*32);
this.viewport.follow(this.player);
console.log(this.rmg.getPlayer().toString());
console.log(this.rmg.getEnemies());
this.playerSpawn = this.rmg.getPlayer().scale(32);
// Do generic setup for a GameLevel

View File

@ -258,7 +258,7 @@ export default class RandomMapGenerator {
this.map.layers[1].data[(room.topLeft.y + i) * width + room.topLeft.x + j] = room.topLayer[i * roomWidth + j];
}
if (room.enemies)
for (let enemy of this.enemies) {
for (let enemy of room.enemies) {
enemy.position.x += room.topLeft.x;
enemy.position.y += room.topLeft.y;
this.enemies.push(enemy);