Unable to remove Objects from Scene
Hi i was trying to remove the bullets from the scene after they finish running the tween.. here is the code i got .. // Handle shooting game.down = function (x, y, obj) { var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y; bullets.push(bullet); tween(bullet, { scaleX: 0.25, scaleY: 0.25 }, { duration: 100, onComplete: function onComplete() { var index = bullets.indexOf(bullet); if (index > -1) { bullets.splice(index, 1); } game.removeChild(bullet); bullet.destroy(); } }); game.addChild(bullet); }; this doesn't seem to actually remove the bullets from the screen.. please help.
5
Be the first to comment