Wednesday, April 28, 2010

2D Particles: Part 1 The Basics

My next tutorial will be on a 2D particle engine. A 2d Particle engine is pretty simple to create, but requires a lot of variables. Therefore it can be overwhelming at first, but hopefully I can break it up in a way that everyone can follow. The engine itself is just a way to control your particles, and the particles are just a texture that is moving, rotating, scaling, and fading. Although there will be a lot of variables in this engine, with a few math tricks and the random number generator, you can create very cool effects with minimal code.
There are three types of particles; static, moving and single instance particles. Static particles are an effect that plays at one predefined position and doesn't move. A moving particle is continuously moving around an object. A single instance effect creates a lot of particles once due to some action, such as a key press, but will not continue to make more particles. We will be creating methods to use all three effects. Creating these effects can be difficult at first using just the variables, because this is such a detatched process. Instead, I will be trying to make a visual creator that will export xml files to be loaded directly without having to create them in code.

Static Effect Playing

Moving Effect when going up

Explosion One time effect

No Source code for this part.

No comments:

Post a Comment