Sign in to follow this  

Problem with Tweens

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)



Share this post

Link to post
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);{blablabla;});tween1.start();//then there's a way to do this:tween1.stop();

I hope this will be useful to someone later.

See ya!

Share this post

Link to post
Share on other sites

I tried your solution but it wasn't working for me.  Ultimately I had to go into the sprite's tween manager and stop each individual tween.  This worked for me:

tween.stop();for (var i in tween._manager._tweens){    tween._manager._tweens[i].stop();}

Share this post

Link to post
Share on other sites

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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.