Well, I want to make a particle system (a very basic one at that). I'm curious as to how I should set it up.
Obviously I'll have a particle class which will have a rect for positioning/size, a velocity vector, a life integer, and perhaps an acceleration vector.
Then I'd have some sort of Particle System class which would manage all the particles. But what sort of operations do these classes need to accomplish to produce different effects?
If it's of any use: I want to make a particle system, because I've been working on a Breakout game. Currently, every time a brick is hit, it loses life, and it's color becomes less intense. Once it is destroyed, I want it to break into particles and have all the particles float down.
Particle Systems
Moderator: Coders of Rage
- RyanPridgeon
- Chaos Rift Maniac
- Posts: 447
- Joined: Sun Sep 21, 2008 1:34 pm
- Current Project: "Triangle"
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C/C++
- Location: UK
- Contact:
Re: Particle Systems
A simple particle system, say for an explosion, will generate a bunch of particles at a given position which all have random velocities. The particles could maybe fade out over time before being destroyed and have a nice texture / colour. This would give reasonable results and be very simple.
For the classes, well obviously you'd want velocity, position, a timer\ and rendering information for each particle, with functions for creating, updating, drawing and deleting the particle. The manager would just need some kind of list (like a C++ vector) for holding references or pointers to each particle, and call the update and creation of the particles from functions like CreateParticle(x, y) or ExplosionAt(x, y) for example.
For the classes, well obviously you'd want velocity, position, a timer\ and rendering information for each particle, with functions for creating, updating, drawing and deleting the particle. The manager would just need some kind of list (like a C++ vector) for holding references or pointers to each particle, and call the update and creation of the particles from functions like CreateParticle(x, y) or ExplosionAt(x, y) for example.