Hello all, I'm trying to re-use sprites like so:
squareTargets = game.add.group();
squareTargets.enableBody = true;
squareTargets.physicsBodyType = Phaser.Physics.ARCADE;
squareTargets.createMultiple(maxSquareTargets, 'square target sheet');
squareTargets.setAll('checkWorldBounds', true);
squareTargets.setAll('outOfBoundsKill', true);
squareTargets.setAll('hasOverlapped', false); //my own property I use in my logic
squareTargets.setAll('frame', 1); // so it displays on the 1 index of my sprite sheet
squareTargets.callAll('animations.add', 'animations', 'explode', [1, 2, 3, 0], 5, false);
I also want the individual sprite to kill() when the explode animation is run, how do I set this at the group level?
I see that I can individually set animations on a sprite and do this:
var explode = singleTarget.animations.add('explode', [1, 2, 3, 0], 5,);
explode.killOnComplete = true;
But I'd rather find a way set the animation on the group and killOnComplete for the animation in one go, rather than loop through the group and define the animation and property (which I suspect is wasteful from a memory point of view).