totallybueno Posted December 29, 2015 Share Posted December 29, 2015 Hi there,I have a problem here... I´m not being able to change the Y destination of a sprite I´m tweening and with yoyo()... I have an item that I tween to an arbitrary position, then I "yoyo" the item to the original position and then I want to tween it again to another arbitrary position buuuuuuuut I´m not being able to do it. Does anyone how to do this?this.positionY = this.game.rnd.between(-100,-50);var myTween = this.game.add.tween(this.mySprite).to({y:this.positionY}, 2000, Phaser.Easing.Cubic.InOut, true, 0, -1);myTween.yoyo(true, 200);myTween.onLoop.add(function(){ this.positionY = this.game.rnd.between(-100,0); myTween.properties.y = this.positionY;},this)Thanks in advance. Link to comment Share on other sites More sharing options...
lewster32 Posted December 30, 2015 Share Posted December 30, 2015 Tweens will try to override the properties they're affecting continuously, so rather than try to modify the tween you'd probably be better off removing the loop and instead create a new tween for each new position when the previous one completes. Link to comment Share on other sites More sharing options...
totallybueno Posted December 31, 2015 Author Share Posted December 31, 2015 Mmmmmm, then I think I´m gonna avoid that, that would be too CPU intense if I have to create tween again and again... ok, feature deleted Thanks lewster32 Link to comment Share on other sites More sharing options...
Recommended Posts