Tony Polinelli
Tarwin Stroh-Spijer

contact [at]
touchmypixel.com

6/25 Easey Street
Collingwood, 3066
Vic, Australia

+61 3 8060 5321

Archive for June, 2009

Sunday, June 21st, 2009

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

Our Friends:

Powered by haXe / poko cms | Copyright 2008-09 TouchMyPixel