fix: bug in getEnemies
This commit is contained in:
parent
d53b8ce4d3
commit
75ce98f947
|
@ -28,6 +28,12 @@
|
||||||
"type": "player",
|
"type": "player",
|
||||||
"x": 5,
|
"x": 5,
|
||||||
"y": 19
|
"y": 19
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "test_dummy",
|
||||||
|
"x": 7,
|
||||||
|
"y": 19,
|
||||||
|
"possibility": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -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.setBounds(0, 0, this.map.width*32, this.map.height*32);
|
||||||
this.viewport.follow(this.player);
|
this.viewport.follow(this.player);
|
||||||
|
|
||||||
console.log(this.rmg.getPlayer().toString());
|
console.log(this.rmg.getEnemies());
|
||||||
this.playerSpawn = this.rmg.getPlayer().scale(32);
|
this.playerSpawn = this.rmg.getPlayer().scale(32);
|
||||||
|
|
||||||
// Do generic setup for a GameLevel
|
// Do generic setup for a GameLevel
|
||||||
|
|
|
@ -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];
|
this.map.layers[1].data[(room.topLeft.y + i) * width + room.topLeft.x + j] = room.topLayer[i * roomWidth + j];
|
||||||
}
|
}
|
||||||
if (room.enemies)
|
if (room.enemies)
|
||||||
for (let enemy of this.enemies) {
|
for (let enemy of room.enemies) {
|
||||||
enemy.position.x += room.topLeft.x;
|
enemy.position.x += room.topLeft.x;
|
||||||
enemy.position.y += room.topLeft.y;
|
enemy.position.y += room.topLeft.y;
|
||||||
this.enemies.push(enemy);
|
this.enemies.push(enemy);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user