Playing with Particles
For a new game I’m designing, I’ve been learning a little about particles. Its actually really simple to get some great effects. I found a good as3 lib http://flintparticles.org – but in the aim of learning, and due to the fact that i need to use haxe not as3 (planning to target iphone) i’ve started from scratch. Ive only implemented a Gravity Well, and Gravity – but plan to add some magnets, simple collisions, brownian motion and maybe particle to particle attraction.
A few important things are:
- Rendering direct to bitmap- not using MovieClip or Sprite – as they kill performance
- Using copyPixels over draw – again for performance
- Using an Object Pool, for less memory and garbage collection issues in the future
- Created an ‘effectors’ interface for applying multiple effects to particles
- Frame independant (time based) motion for more predictable performance
so lets see a test:
Update: Here’s another example – not in the source, but just adding a colorTransform- fun fun!
heres the haxe code: download
cheers,
Tony
This entry was posted on Sunday, June 21st, 2009 at 6:12 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
2 comments
-
July 19th, 2009 at 2:11 pmHi cool stuff dude, but you should really try to make your SWF’s click to activate and disable the loop when the mouse leaves the stage.
I just had to kill my browser,
Keep up the good work
Cheers mate -