This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

Spilli
Spilli presents ...

2012/7/17

Particle Emitter

I was recently asked how my particle emitter worked on my game Bounce. This is a quick re-write of what it pretty much is.

It has some cool features which can reduce the GC been called as often.

* Cached colored particles (Current color)
* Recycled inactive particles instead of constantly creating new ones.
* Basic physics, could be improved.

Also please note I've squished some classes together, they're easy to redo so they have their own class.

Hope you enjoy and I look forward to seeing it used in some scenarios.

If you use it please post the link of the scenario below so I can see it in action.

Thanks :)

6815 views / 1372 in the last 7 days

16 votes | 0 in the last 7 days

Tags: physics with-source particle effect emitter

This scenario is a member of: sfx (special effects)


open in greenfoot
Your browser is ignoring the <APPLET> tag.
nooby123nooby123

2012/7/18

It looks really cool and realistic! Great job!
SpilliSpilli

2012/7/18

Glad you guys like it. :)
darkmist255darkmist255

2012/7/18

Thank you so much! I've been trying to replicate this with very little success.
UpupzealotUpupzealot

2012/7/18

Good job
SPowerSPower

2012/7/18

Looks great! I'll look where I can use it!
erdelferdelf

2012/7/18

how can I kill an instance of the emitter?
SpilliSpilli

2012/7/18

If you no longer want particles to be emitted don't call the emit(x, y) method.
winnerpigwinnerpig

2012/7/26

so cool! I like it!
looks very realistic. Goot job!
shrucis1shrucis1

2013/11/17

Wow, this is awesome! I really want to use it in some of my projects, but there's one thing I can't figure out: Where in the code do you make the particles drift off to the left? When I make the x and y forces 0, it still drifts left. I've spent the last 3 hours combing the code, but I still can't find it. Can you help me with this?

See all comments

Want to leave a comment? You must first log in.

Who likes this?

Entity1037 edparrish bourne Poli Gevater_Tod4711 Moritz MathManiac adamkjelstroem jellypickles uboiz winnerpig MatheMagician SPower erdelf darkmist255 nooby123