Closed goshki closed 8 years ago
It is definitely an issue. Previously I'd suggested giving FlxBasic a tweener, so tweens can update at the rate of any other thing that updates. This way you could have tweens attached to a sprite, state, group etc.
Instead of calling FlxTween.tween, you'd just call tween() or mySprite.tween().
TweenLite has TimeLines which allow you to organize tweens in fancy ways. The "global" root tween manager is just another TimeLine.
I'm not a fan of giving Basics a tween because you'd need to use FlxTween.tween anyway if you tween more than one value at a time.
@MSGhero I wasn't suggesting to give FlxBasics a single tween. I was suggesting to give them a tweener, so they each behave exactly as FlxTweenManager does now. You would be able to have multiple tweens on any FlxBasic. I believe Flash/HaxePunk and a few others do something like this.
I've used TweenLite's TimeLines in some ActionScript project some (long) time ago. While it's true that it helped organizing tweens, at the same time it was really hard to properly control their execution. By default TimeLines are running on ENTER_FRAME event and it's been problematic to pause/unpause them to cooperate with Flixel.
i'm thinking about using Delta tween library: https://github.com/furusystems/Delta (maybe extended somehow) instead of existing
@Beeblerox You want to replace the current system with it?
@Gama11 yes, i do. it's not flexible enough. there is no easy way to chain tweens for example
I think that's a good approach overall for HaxeFlixel (using new external libraries code to replace old basic core functionality).
What happened to the all macros + tweens thing BTW?
Not sure that's a great idea, the current system is fairly solid, could always improve it.
Closing this, since it's in principle the same issue as #1087.
I do like Joe's suggestion though.
I remember a conversation about defficiencies of the tweening system, expecially in regard of inability to control when a given tween is updated. Maybe a solution to this problem would be to add the ability of tween grouping. What I mean by that is that tweens would be created withing an indicated group, i.e.: global tweens, state tweens, substate tweens, group tweens and sprite tweens. They could be created in such manner:
Moreover, state/substate and group tweens would pracitcally be reduced to a group tween that would update when its parent group updates (and the above methods would be strictly convenience methods). Similarly, sprite tweens would be updated when their parent sprite updates. Of course it would require the developer to always call super.update() or to call some kind of a updateTweens() function manually.
Quite possibly, the TweenManager class would become obsolete because tween parents would be responsible for updating their tweens. On the other hand such change would definitely cause some inconsistencies in existing code (tween updates would be launched at different moments).
Other thing to keep in mind is that such solution add extra responsibilities to HaxeFlixel classes such as FlxGroup and FlxSprite (FlxObject?).