diff --git a/js/enemy.mjs b/js/enemy.mjs index 15468a8..61a8ce6 100644 --- a/js/enemy.mjs +++ b/js/enemy.mjs @@ -68,11 +68,15 @@ Event.listen("level/load/enemy", enemies => { const {pos, size} = data; const enemy = create(pos[0], pos[1], size[0], size[1]); - set_behaviour(enemy, data.behaviour); + if (data.hasOwnProperty("behaviour")) { + set_behaviour(enemy, data.behaviour); + } const meta = Entity.get_meta(enemy); - for (const [key, value] of data.meta) { - meta.set(key, value); + if (data.hasOwnProperty("meta")) { + for (const [key, value] of data.meta) { + meta.set(key, value); + } } add(enemy);