I am trying to update the X and Y properties of a tween that I have created for a group of sprites. I am currently using the updateTo
function to set a new value for each property that I want to update, in the update function.
function create ()
{
var image1 = this.add.image(50, 100, 'block');
var image2 = this.add.image(60, 200, 'block');
var image3 = this.add.image(70, 300, 'block');
tween = this.tweens.add({
targets: [ image1, image2, image3 ],
x: '+=600',
y: '+=200',
duration: 4000,
ease: 'Power3'
});
}
function update () {
tween.updateTo('x', Phaser.Math.Between(200, 800));
}
However it seems that this only updates the X value for the very first box, the other two keep their original values.
Can updateTo
be used for groups, or am I doing something wrong?
Thanks, Conor