Jump to content

How can I change a property of a tween looped with yoyo()


totallybueno
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...