Archive for June, 2009
Playing with Particles
Sunday, June 21st, 2009For 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
Posted in Uncategorized | 2 Comments »