A more convenient way to cancel a FlxTween?

  • There's something that bothers me a bit when I'm working on complex tween interactions, which is actually cancelling them.

    AFAIK, by doing:

    // Cancel the old tween
    if (_tween != null)

    ... you can easily stop a tween, which is useful since you don't have to wait for the current tween to finish (otherwise, visual glitchs might appear).

    On similar frameworks, you can kill tweens by doing, for example:

     TweenLite.killTweensOf(YOUR_OBJECT) ;

    I understand that you can kill all tweens by doing:


    ... but is not that convenient.

    So, my question would be... is there a way to find or perhaps, to assign a current tween to an object, so it can be killed more easily? For example, FlxSprite can hold a FlxPath, which can be easily accessed.

    Would be fantastic if any like that could be done for tweens. Few examples:




    I'm not afraid to dig on the code and do this myself, but I was wondering if someone actually did something like this, or found out a way to do it in a more convenient way.

    Many thanks in advance! :heart_decoration:

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.