This topic is now archived and is closed to further replies.


2D particle systems

Recommended Posts

can anyone give me an example of 2D particle systems that you could use for say bits of fire in an explosion or for pieces of an item when it breaks? i''m trying to give my 2D engine a bit more realism, and i thought that a particle system would be the best way to do it. thanks, david

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Look at this site
there''s a lot of informations.

Share this post

Link to post
Share on other sites
Hi neonstar,

I will do my best to help you, but i''ve not yet finished my PSystem 3D.

First you need an array of Particule. I''ve defined it like this

Point2d Position; //Position of particle vs emitter
CVector Momentum; //Force apply on a particule

CMesh *Object; //I have add that for PSystem with a mesh
// like pieces of glass flying around

Then, you defined a Emmiter for those particules

Point2d Position; //Position of emitter in the world
CVector Orientation; //Orientation of emmiter (where
//particules go)

float fSpray; // The Angle of the Emitter Spray

float fTimeBirth; //How long to wiat for another birth
float fBirthTresh; // --

float fLifetime; //How long a particule last..
float fLifeTresh; //I dont want particules to die at the
// same time

float fRandom;

DWORD NbMaxParticules; //Maximum count of particules
LList ListParticules; // A LinkedList Contaning a List of
// all Particules

All variables with ''Tresh'', which stand for ''Treshold'', are number to give each PSysteme behave differently.

Like i told you before, i''ve not completed my implentation yet.
But u can what some other things in your DataStruct to make your PSystem make efficent or with more F/X.

You will need a bunch of function to make a usefull use of your PSystem.

void Emitter::AnimateSystem (float fTimeSlice)
MakeBirth; // Check if its the right time to add a Particule
// - Birth Time Reach, NbParticule <
// MaxParticules

AnimateParticule; // Animate each particule with is own force

You will nedd disply it too, to do that simply parse the LList and show Particule at their respective position

Just hope this with help you...


Share this post

Link to post
Share on other sites