ParticleEmitter

Description

When created by a specific ParticleSystem, the emitter receives specific value ranges for the particles it will create. The emitter class will initially create the maximum amount of particles needed, as not to need to create more during run-time. When set active, the emitter 'releases', and sets off the particles, which then function independently.

Relationships

  • ParticleSystem : The ParticleSystem will create a ParticleEmitter and set its values
  • Particle : The ParticleEmitter class creates and maintains by the particles

Members

  • List<Particle> particles - A list of particles, the size of maxNumParticles
  • GameTexture particleTexture - The texture of the particle
  • int numberOfParticles - The number of particles which emit, within the range of minNumParticles and maxNumParticles
  • float minStartVelocity - Minimum velocity for a particle
  • float maxStartVelocity - Maximum velocity for a particle
  • float minAcceleration - Minimum acceleration for a particle
  • float maxAcceleration - Maximum acceleration for a particle
  • float minLifetime - Minimum amount of time for which a particle will exist
  • float maxLifetime - Maximum amount of time for which a particle will exist
  • float minScale - Minimum scale for a particle
  • float maxScale - Maximum scale for a particle
  • float minNumParticles - Minimum number of particles which the emitter will contain
  • float maxNumParticles - Maximum number of particles which the emitter will contain
  • float minRotationSpeed - Minimum rotational speed for a particle
  • float maxRotationSpeed - Maximum rotational speed for a particle
  • Vector2 position - x,y position of emitter, from which particles come out

Methods

  • Update
    • Updates particles and possible movement of emitter
  • CreateParticles
    • Creates the maximum amount of particles needed and adds to particle list
  • AddParticle
    • Retrieves a free particle
    • Initializes particle by setting particle attributes using random values within min/max range specified by the emitter
    • Sets particle to active
  • Move
    • Accepts a vector2 value, which is added to the position of the emitter
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License