Looking for a confetti / particle physics library

To celebrate a win, I would like some confetti cannons in my game. before implementing it myself,
I'd ask around whether someone made that already, or feels like doing so. I'm not in a hurry with this, since it's a cool visual extra that I could add anytime.

I imagine these parameters:

  • particle size
  • particle shape (or always triangles, or an imagetable containing particle images)
  • particle lifetime range (milliseconds) ie. 2000 -- 5000
  • particle rotation-degrees-per-second range ie. -720 -- 720
  • particle emitter source location (x,y)
  • particle emitter direction range in degrees ie. 80 -- 110
  • initial particle speed range in pixels-per-second
  • particle emitter rate in particles-per-second
  • gravity strength x, gravity strength y

interface

  • getParticleCount()
  • calcTimeStep() - updates particle positions and creates particles
  • draw() function draws all particles as simulated. Library doesn't have to deal with what image to draw to, since we have the existing image:lockFocus() and drawOffset() API's

I'n not sure yet whether I would prefer the simulation this to be time- or frame-based

Anyone up for this?

1 Like

Might be more relevant in the Collaboration Forum