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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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