I have a group of stars. It gives me only 1 star at the beginning. I want to make it, if I take this star, it gives me 2 stars, if I take 2 stars, it gives me 3, and so on. How can I do it?
stars = this.physics.add.group({
key: 'star',
repeat: -1,
setXY: {
x: Phaser.Math.RND.between(0, 900),
y: Phaser.Math.RND.between(0, 600),
frameQuantity: 2,
repeat: 5
}
});
this.physics.add.overlap(player, stars, collectStar, null, this);
function collectStar (player,star){
star.disableBody(true, true);
score += 2; // COUNT BY 2
scoreText.setText('Score: ' + score);
}