This project is read-only.

Documentation index

Please note that this documentation is still in draft.


XNA 2D Particle Engine provides a simple and flexible way of implementing a particle engine in your XNA GS 4.0 projects. You can include the particle engine simply as a game component to your project.


The engine works with particle emitters, which emits the particles in a pre-defined way. For every particle source, you have to create a new emitter. Each emitter can be configured separately. Each emitter is added to the game component's emitter array, and can be accessed through the emitter array:

Emitter myEmitter = new Emitter();
// Emitter configuration goes here

Emitter properties

Each emitter has public properties you can configure. These properties are also accessible and can be changed while the game is running.

public properties Emitter class
Property name Type Description
ParticleList List<Particle>
EmittedNewParticle bool
LastEmittedParticle Particle
TextureList List<Texture2D>
Active bool
ParticleLifeTime int (in milliseconds)
Position Vector2
ParticleDirection RandomMinMax
ParticleSpeed RandomMinMax
RandomEmissionInterval RandomMinMax
ParticleRotation RandomMinMax
RotationSpeed RandomMinMax
ParticleFader ParticleFader
ParticleScaler ParticleScaler
Opacity int

Particle properties

Coming soon

Example implementation

Note: An example implementation is included in the source of the engine.

using X2DPE;
using X2DPE.Helpers;
Adding the Particle engine as a Game Component
public class Game1 : Microsoft.Xna.Framework.Game
	ParticleComponent particleComponent = new ParticleComponent(this);
Configure and add a new particle emitter to the Particle component
protected override void LoadContent()
	Emitter emitter = new Emitter()
		Active = false,	
		TextureList = new List<Texture2D>()
		RandomEmissionInterval = new RandomMinMax(8.0d),
		ParticleLifeTime = 2000,
		ParticleDirection = new RandomMinMax(0, 359),
		ParticleSpeed = new RandomMinMax(0.1f, 1.0f),
		ParticleRotation = new RandomMinMax(0, 100),
		RotationSpeed = new RandomMinMax(0.015f),
		ParticleFader = new ParticleFader(false, true, 1350),
		ParticleScaler = new ParticleScaler(false, 0.3f)


Last edited Dec 22, 2010 at 7:50 AM by bwuyster, version 30


No comments yet.