1 decade ago by inihility
I have an entity A that spawns bullets from another entity B, I need to spawn several instances of entity A at any given time but it appears that not all of them spawn entity B properly.
I have this code in entity A's update function:
What could I be doing wrong? It's an odd problem, sometimes none of entity A doesn't spawn entity B at all, but usually only one does and when I destroy/kill it another entity A picks up spawning entity B.
I want to also note that other entities that try to spawn entity B as a bullet also suffer from the same problem of only one spawning them properly or none spawning.
I have this code in entity A's update function:
update: function(){ if (this.attackTimer.delta() > 0) { console.log("ENEMY BULLET1"); ig.game.spawnEntity(EntityEnemyBullet, this.pos.x, this.pos.y, {flip: this.flip}); this.attackTimer.reset(); } this.parent(); },
What could I be doing wrong? It's an odd problem, sometimes none of entity A doesn't spawn entity B at all, but usually only one does and when I destroy/kill it another entity A picks up spawning entity B.
I want to also note that other entities that try to spawn entity B as a bullet also suffer from the same problem of only one spawning them properly or none spawning.