Bike Posted September 7, 2018 Share Posted September 7, 2018 Trying to learn Phaser 3 by making a simple card game, I am trying to deal 10 cards slightly offset of each other. Is this achievable through one tween looping 10 times and updating X/Y values or would I need to consider chaining 10 different tweens or creating/playing in a timedEvent loop. The following snippet doesn't appear to change the location the card tweens to on the next play back tween = this.tweens.add({ targets: cardSprite, x: 200, y:400, ease: 'Power1', duration: 500, loop: 10, onLoop: tweenOnLoop }); }, function tweenOnLoop (tween, targets) { tween.x = Phaser.Math.Between(1, 800); tween.y = Phaser.Math.Between(1, 600); } Link to comment Share on other sites More sharing options...
Nitwit Oaf Posted January 3, 2020 Share Posted January 3, 2020 function tweenOnLoop (tween, targets) { tween.updateTo('x', Phaser.Math.Between(1, 800)); tween.updateTo('y', Phaser.Math.Between(1, 600)); } Link to comment Share on other sites More sharing options...
Recommended Posts