1 decade ago by stahlmanDesign
I had an entity create another entity in its init() method. This works fine, except in Weltmeister which can't find ig.game.spawnEntity.
I made a work around that calls it once in the update method and then ignores it.
But is there a way to make it work the first way by including game.spawnEntity in require or something?
init: function (x, y, settings) { this.parent(x, y, settings); // next line throws an error in Weltmeister this.whitebox = ig.game.spawnEntity( EntityWhitebox, this.pos.x, this.pos.y, { flip: this.flip }); }, ...
I made a work around that calls it once in the update method and then ignores it.
init: function (x, y, settings) { this.parent(x, y, settings); }, createWhitebox: function(){ this.whitebox = ig.game.spawnEntity(EntityWhitebox, this.pos.x, this.pos.y, { flip: this.flip }); }, update: function () { if (this.whitebox == null){ this.createWhitebox(); } ... }
But is there a way to make it work the first way by including game.spawnEntity in require or something?