fix error in enemy loading code.
enemy loading no longer assumes that the enemy-describing data it recieves has certain optional properties.
This commit is contained in:
parent
4de8228579
commit
d39c226046
1 changed files with 7 additions and 3 deletions
|
@ -68,12 +68,16 @@ Event.listen("level/load/enemy", enemies => {
|
|||
const {pos, size} = data;
|
||||
const enemy = create(pos[0], pos[1], size[0], size[1]);
|
||||
|
||||
if (data.hasOwnProperty("behaviour")) {
|
||||
set_behaviour(enemy, data.behaviour);
|
||||
}
|
||||
|
||||
const meta = Entity.get_meta(enemy);
|
||||
if (data.hasOwnProperty("meta")) {
|
||||
for (const [key, value] of data.meta) {
|
||||
meta.set(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
add(enemy);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue