fix error in enemy behaviour initialization.
This commit is contained in:
parent
094369460b
commit
25f020dd78
1 changed files with 2 additions and 7 deletions
|
@ -17,8 +17,7 @@ function tick_enemy (enemy, deltatime) {
|
|||
|
||||
if (meta.has("behaviour")) {
|
||||
const b = meta.get("behaviour");
|
||||
if (behaviours.exists(b)) {
|
||||
const callback = behaviours.get_tick(b);
|
||||
if (behaviours.exists(b)) { const callback = behaviours.get_tick(b);
|
||||
callback(enemy, deltatime);
|
||||
}
|
||||
}
|
||||
|
@ -47,10 +46,6 @@ export function create (...args) {
|
|||
return enemy;
|
||||
}
|
||||
|
||||
function set_behaviour (enemy, behaviour, params) {
|
||||
behaviours.init(enemy, behaviour, params);
|
||||
}
|
||||
|
||||
export function add (enemy) {
|
||||
enemies.push(enemy);
|
||||
}
|
||||
|
@ -69,7 +64,7 @@ Event.listen("level/load/enemy", enemies => {
|
|||
const enemy = create(pos[0], pos[1], size[0], size[1]);
|
||||
|
||||
if (data.hasOwnProperty("behaviour")) {
|
||||
set_behaviour(enemy, data.behaviour);
|
||||
behaviours.init(enemy, data.behaviour, Object.fromEntries(data.meta));
|
||||
}
|
||||
|
||||
const meta = Entity.get_meta(enemy);
|
||||
|
|
Loading…
Reference in a new issue