AlexArroyoDuque Posted February 7, 2014 Share Posted February 7, 2014 Hi. I have a sprite with chained tweens. The first twenn move the x position of the sprite. And the second tween change the scale to -1.2. I do this because the sprite must turn. My problem is that the size doesn't follow correctly the sprite. This is my code. this.mummy = this.game.add.sprite(580, 406, 'mummy'); this.mummy.scale.setTo(-1.2, 1.2); this.mummy.body.gravity.y = 8; this.mummy.animations.add('walk'); this.mummy.animations.play('walk', 12, true); this.game.add.tween(this.mummy) .to({ x: 450 }, 2500, Phaser.Easing.Linear.None) .to({ x: 580 }, 2500, Phaser.Easing.Linear.None) .loop() .start(); this.game.add.tween(this.mummy.scale) .to({ x: 1.2 }, 100, Phaser.Easing.Linear.None, null, 2400) .to({ x: -1.2 }, 100, Phaser.Easing.Linear.None, null, 2400) .loop() .start(); Any idea? greetings! Link to comment Share on other sites More sharing options...
Luiz Bills Posted February 8, 2014 Share Posted February 8, 2014 this.game.add.tween(this.mummy) .to({ scale: 1.2 }, 100, Phaser.Easing.Linear.None, null, 2400) .to({ scale: -1.2 }, 100, Phaser.Easing.Linear.None, null, 2400) .loop() .start(); Link to comment Share on other sites More sharing options...
AlexArroyoDuque Posted February 8, 2014 Author Share Posted February 8, 2014 Hi, thanks for your reply... But your solution doesn't works good Link to comment Share on other sites More sharing options...
rich Posted February 8, 2014 Share Posted February 8, 2014 Set the sprite anchor to the middle (0.5) Link to comment Share on other sites More sharing options...
AlexArroyoDuque Posted February 8, 2014 Author Share Posted February 8, 2014 Thanks!Works perfectly! Link to comment Share on other sites More sharing options...
Recommended Posts