Closed kamranayub closed 3 years ago
@kamranayub :+1:
If we get rid of the Effect array and make effects permanent we wouldn't need to worry about order.. not sure this is okay. But that would sacrifice the ability to undo an effect... unless we did some sort of command pattern and implement an applyEffect
and an removeEffect
. Or we can keep the effect array and play some tricks in the set()
function.
SpriteEffects right now are fairly heavy items, so anything we can do to make them better is awesome.
This issue hasn't had any recent activity lately and is being marked as stale automatically.
Closed by #1730
I think effects will need the same treatment as Actions and be separated into their own API chain. Furthermore, it is all too common for Excalibur to call
clearEffects
andaddEffect
, which can remove any other custom effects on a Sprite.Proposing something like this:
This supports built-in effects with full intellisense and then registering custom effects at a global level. All effects are available to every sprite/whatever, but you can clear them out or set them without adding/removing.
Not sure yet about ordering of effects using this method. Maybe
ISpriteEffect
has anorder
and you can customize it when needed.