1 decade ago by John
So I'm making a game where I spawn the same enemy over and over again, but I'm having trouble with the .kill function killing all of them when one gets hit. Any ideas what I'm doing wrong?
spawn code:
kill code:
spawn code:
if(canSpawn == true){ var sy = Math.floor(Math.random() * ig.system.height - 55) + 55; var sx = ig.system.width + 50; ig.game.spawnEntity(EntityChicken,sx,sy); canSpawn = false; setTimeout(function(){ canSpawn = true; }, 1000); }
kill code:
if(killMe == true){ this.kill(); }