HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.93k stars 427 forks source link

FlxFilterFrames Issues #3131

Open Geokureli opened 2 months ago

Geokureli commented 2 months ago

I find FlxFilterFrmaes to be an odd class in it's usage. It acts like a component that is added to sprites that can be easily modified or removed, but in actually it's pretending to do so and in fact getting the sprite's frames, drawing a new bitmap and replacing the frames of the target sprite with the new ones and changing the offset of the sprite to account for the newly added space. While handy for one-offs, the demo does this in a way I would never recommend, and showcases caveats from doing so (Which are now fixed via https://github.com/HaxeFlixel/flixel-demos/pull/349)

When i think of a similar util that behaves in a better way, I think of FlxTileFrames.fromBitmapAddSpacesAndBorders, which takes an asset and returns a new asset with the effect baked in, this is beneficial for many reasons, it doesn't make the effect seem "cost free", no one expects to be able to adjust the padding after it's application without generating an entirely new asset, where FlxFilterFrames obscures this, imo.