FLuNK – FLiNT Particles in FlashPunk
April 25, 2011
I started dabbling in FlashPunk and felt a need for more advanced particles, so "FLuNK" was born!
First version is guaranteed to have shortcomings (bugs etc), but it should be enough to get you started.
I've made two renderers, the EntityRenderer which shows particles as FlashPunk Entity objects, and the GraphicRenderer which draws everything in a single Graphic. Or rather, the renderer itself extends Graphic and draws upon FlashPunks BitmapData in the update method.
Obviously the GraphicRenderer is faster, but not by very much. Check out the demo for comparison. The EntityRenderer allows you to check collisions, and that's cool so you might want to use both depending on the situation.
- Obviously anything 3D from FLiNT has not been accounted for.
- Since collision with rotated entities in FlashPunk is tricky in itself (just found the forum threads), this has been left alone.
- Actions/activities that regard the mouse obviously doesn't work the same (or at all).
Possible planned updates:
- Support for the simple display objects in FLiNT (RadialDot etc..).
- Support for things like Particle2DUtils.createRectangleParticlesFromBitmapData();
This is required in making exploding images and such.
- Initializers that take multiple images and weighted arrays, much like the FLiNT implementation.
Check the demo below. Download:
- FLuNK v0.2 — Only the necessary classes.
- FLuNK v0.2 — Full source of demo, including todays latest FLiNT & FlashPunk.
* This is now updated from v0.1 to v.02, sorting out a memory leak bug in the EntityRenderer. Demo below now reflects that as well.
It's a FlashDevelop project. Code is hopefully straightforward enough for you to grasp.
Read more about FlashPunk here.
Read more about FLiNT Particles here.