I’m trying to duplicate the cherry as per Phaser’s tutorial ‘Making your first game - Stardust’ but it doesn’t work:
var cherry;
cherry = this.physics.add.group(
{
key: 'cherry',
repeat: 6,
setXY: { x: 400, y: 100, stepX: 70 }
}
);
cherry.children.iterate(function (child) {
child.setBounceY(Phaser.Math.FloatBetween(0.4, 0.8));
});
cherry = this.physics.add.sprite(380, 250, 'cherry');
cherry.setBounce(0.2);
cherry.setSize(40, 40, true);
this.physics.add.collider(cherry, platforms);