Jump to content

Problem with Tweens


CaueCR
 Share

Recommended Posts

Hello again!

I was trying to use a lot of tweens in some scenes of my game, and I wasn't able to find a way to stop the tweens.

I've tried to set a flag to false to stop it from ending, But I found out the hard way that they wasn't actually stopping. When I started another tween, my object's coordinates were messed up because of the previous interruption of tweens.

Is there a way to stop a tween in a way that it REALLY stops? I'd be very grateful if someone could answer this to me.

(PS.: I've already found three other posts about it, but their solution (myTween.stop();) doesn't work anymore, it seems)

 

Thanks!

Link to comment
Share on other sites

I've found my answer already. The problem was in the declaration of the tween:

//I was doing this:game.add.tween(blabla).to(bblablablabla).start().onComplete.add(function(){blablabla;});//When I should do this:tween1 = game.add.tween(blabla);tween1.to(bblablablabla).onComplete.add(function(){blablabla;});tween1.start();//then there's a way to do this:tween1.stop();

I hope this will be useful to someone later.

See ya!

Link to comment
Share on other sites

  • 6 months later...
 Share

  • Recently Browsing   0 members

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