Hi,
So for school, we’re assigned to change the phaser tutorial a bit. So right now, each time you collect the 12 stars, a bomb spawns. I made a pretty big map (2000,600) and want to have multiple stars in it. And each time you collect one, a bomb spawns in a radius arround you. How could I do that?
This is the code from the tutorial that has to be changed:
if (stars.countActive(true) === 0)
{
// A new batch of stars to collect
stars.children.iterate(function (child) {
child.enableBody(true, child.x, 0, true, true);
});
var x = (player.x < 400) ? Phaser.Math.Between(400, 800) : Phaser.Math.Between(0, 400);
var bomb = bombs.create(x, 16, 'bomb');
bomb.setBounce(1);
bomb.setCollideWorldBounds(true);
bomb.setVelocity(Phaser.Math.Between(-200, 200), 20);
bomb.allowGravity = false;
}