# CCParticleSystemBase Class Reference

Inherits from | CCNode : CCResponder : NSObject
Conforms to | CCBlendProtocol CCShaderProtocol CCTextureProtocol
Declared in | CCParticleSystemBase.h

## Overview

Felxbile particle system.

### Attribute overview of a particle system

- Gravity Mode (Mode A)

  - Gravity
  - Direction
  - Speed +- variance
  - Tangential acceleration +- variance
  - Radial acceleration +- variance

- Radius Mode (Mode B)

  - Start Radius +- variance
  - End Radius +- variance
  - Rotate +- variance

- Properties common to all modes

  - Life +- variance
  - Start spin +- variance
  - End spin +- variance
  - Start size +- variance
  - End size +- variance
  - Start color +- variance
  - End color +- variance
  - Life +- variance
  - Blending function

- Texture

### Supported editors

- Particle Designer http://particledesigner.71squared.com/

### Notes

cocos2d supports all the variables used by Particle Designer plus a bit more:

- Spinning particles (supported when using CCParticleSystemQuad)
- Tangential acceleration (Gravity mode)
- Radial acceleration (Gravity mode)
- Radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only)

## Tasks

### Accessing Particle Attributes

- `active` property
- `particleCount` property
- `duration` property
- `sourcePosition` property
- `posVar` property
- `life` property
- `lifeVar` property
- `angle` property
- `angleVar` property
- `startSize` property
- `startSizeVar` property
- `endSize` property
- `endSizeVar` property
- `startColor` property
- `startColorVar` property
- `endColor` property
- `endColorVar` property
- `startSpin` property
- `startSpinVar` property
- `endSpin` property
- `endSpinVar` property
- `emissionRate` property
- `totalParticles` property
- `blendAdditive` property
- `particlePositionType` property
- `autoRemoveOnFinish` property
- `resetOnVisibilityToggle` property
- `emitterMode` property

### Accessing Gravity Mode Specific Attributes

- `gravity` property
- `speed` property
- `speedVar` property
- `tangentialAccel` property
- `tangentialAccelVar` property
- `radialAccel` property
- `radialAccelVar` property

### Accessing Radius Mode Specific Attributes

- `startRadius` property
- `startRadiusVar` property
- `endRadius` property
- `endRadiusVar` property
- `rotatePerSecond` property
- `rotatePerSecondVar` property

### Creating a CCParticleSystem Object

- `+ particleWithFile:`
- `+ particleWithTotalParticles:`

### Initializing a CCParticleSystem Object

- `– initWithFile:`
- `– initWithDictionary:`
- `– initWithDictionary:path:`
- `– initWithTotalParticles:`

### Particle System Management

- `– stopSystem`
- `– resetSystem`

## Properties

### active

True if particle system active.

`@property (nonatomic, readonly) BOOL active`

#### Declared In

`CCParticleSystemBase.h`

### angle

Angle of each particle.

`@property (nonatomic, readwrite, assign) float angle`

#### Declared In

`CCParticleSystemBase.h`

### angleVar

Angle variance of each particle.

`@property (nonatomic, readwrite, assign) float angleVar`

#### Declared In

`CCParticleSystemBase.h`

### autoRemoveOnFinish

True will remove particle system on completition.

`@property (nonatomic, readwrite) BOOL autoRemoveOnFinish`

#### Declared In

`CCParticleSystemBase.h`

### blendAdditive

True to enable blend additive mode. (GL_SRC_ALPHA, GL_ONE).

`@property (nonatomic, readwrite) BOOL blendAdditive`

#### Declared In

`CCParticleSystemBase.h`

### duration

How many seconds the emitter wil run. -1 means ‘forever’.

`@property (nonatomic, readwrite, assign) float duration`

#### Declared In

`CCParticleSystemBase.h`

### emissionRate

Emission rate of the particles.

`@property (nonatomic, readwrite, assign) float emissionRate`

#### Declared In

`CCParticleSystemBase.h`

### emitterMode

Set emitter mode mechanism.

`@property (nonatomic, readwrite) CCParticleSystemMode emitterMode`

#### Declared In

`CCParticleSystemBase.h`

### endColor

End color and end color variation of each particle.

`@property (nonatomic, readwrite, strong) CCColor *endColor`

#### Declared In

`CCParticleSystemBase.h`

### endColorVar

End color variance of each particle.

`@property (nonatomic, readwrite, strong) CCColor *endColorVar`

#### Declared In

`CCParticleSystemBase.h`

### endRadius

The ending radius of the particles. Only available in ‘Radius’ mode.

`@property (nonatomic, readwrite, assign) float endRadius`

#### Declared In

`CCParticleSystemBase.h`

### endRadiusVar

The ending radius variance of the particles. Only available in ‘Radius’ mode.

`@property (nonatomic, readwrite, assign) float endRadiusVar`

#### Declared In

`CCParticleSystemBase.h`

### endSize

End size in pixels of each particle.

`@property (nonatomic, readwrite, assign) float endSize`

#### Declared In

`CCParticleSystemBase.h`

### endSizeVar

End size variance in pixels of each particle.

`@property (nonatomic, readwrite, assign) float endSizeVar`

#### Declared In

`CCParticleSystemBase.h`

### endSpin

End spin of each particle.

`@property (nonatomic, readwrite, assign) float endSpin`

#### Declared In

`CCParticleSystemBase.h`

### endSpinVar

End spin variance of each particle.

`@property (nonatomic, readwrite, assign) float endSpinVar`

#### Declared In

`CCParticleSystemBase.h`

### gravity

Gravity value. Only available in ‘Gravity’ mode.

`@property (nonatomic, readwrite, assign) CGPoint gravity`

#### Declared In

`CCParticleSystemBase.h`

### life

Life time of each particle.

`@property (nonatomic, readwrite, assign) float life`

#### Declared In

`CCParticleSystemBase.h`

### lifeVar

Life variance of each particle.

`@property (nonatomic, readwrite, assign) float lifeVar`

#### Declared In

`CCParticleSystemBase.h`

### particleCount

Quantity of particles that are being simulated at the moment.

`@property (nonatomic, readonly) NSUInteger particleCount`

#### Declared In

`CCParticleSystemBase.h`

### particlePositionType

Particles movement type: Free or Grouped.

`@property (nonatomic, readwrite) CCParticleSystemPositionType particlePositionType`

#### Declared In

`CCParticleSystemBase.h`

### posVar

The Position variance of the emitter.

`@property (nonatomic, readwrite, assign) CGPoint posVar`

#### Declared In

`CCParticleSystemBase.h`

### radialAccel

Radial acceleration of each particle. Only available in ‘Gravity’ mode.

`@property (nonatomic, readwrite, assign) float radialAccel`

#### Declared In

`CCParticleSystemBase.h`

### radialAccelVar

Radial acceleration variance of each particle. Only available in ‘Gravity’ mode.

`@property (nonatomic, readwrite, assign) float radialAccelVar`

#### Declared In

`CCParticleSystemBase.h`

### resetOnVisibilityToggle

True particle system will reset upon visibility toggling to True.

`@property (nonatomic, readwrite) BOOL resetOnVisibilityToggle`

#### Declared In

`CCParticleSystemBase.h`

### rotatePerSecond

Number of degress to rotate a particle around the source pos per second. Only available in ‘Radius’ mode.

`@property (nonatomic, readwrite, assign) float rotatePerSecond`

#### Declared In

`CCParticleSystemBase.h`

### rotatePerSecondVar

Variance in degrees for rotatePerSecond. Only available in ‘Radius’ mode.

`@property (nonatomic, readwrite, assign) float rotatePerSecondVar`

#### Declared In

`CCParticleSystemBase.h`

### sourcePosition

The source position of the emitter.

`@property (nonatomic, readwrite, assign) CGPoint sourcePosition`

#### Declared In

`CCParticleSystemBase.h`

### speed

Speed of each particle. Only available in ‘Gravity’ mode.

`@property (nonatomic, readwrite, assign) float speed`

#### Declared In

`CCParticleSystemBase.h`

### speedVar

Speed variance of each particle. Only available in ‘Gravity’ mode.

`@property (nonatomic, readwrite, assign) float speedVar`

#### Declared In

`CCParticleSystemBase.h`

### startColor

Start color of each particle.

`@property (nonatomic, readwrite, strong) CCColor *startColor`

#### Declared In

`CCParticleSystemBase.h`

### startColorVar

Start color variance of each particle.

`@property (nonatomic, readwrite, strong) CCColor *startColorVar`

#### Declared In

`CCParticleSystemBase.h`

### startRadius

The starting radius of the particles. Only available in ‘Radius’ mode.

`@property (nonatomic, readwrite, assign) float startRadius`

#### Declared In

`CCParticleSystemBase.h`

### startRadiusVar

The starting radius variance of the particles. Only available in ‘Radius’ mode.

`@property (nonatomic, readwrite, assign) float startRadiusVar`

#### Declared In

`CCParticleSystemBase.h`

### startSize

Start size in pixels of each particle.

`@property (nonatomic, readwrite, assign) float startSize`

#### Declared In

`CCParticleSystemBase.h`

### startSizeVar

Size variance in pixels of each particle.

`@property (nonatomic, readwrite, assign) float startSizeVar`

#### Declared In

`CCParticleSystemBase.h`

### startSpin

Start spin of each particle.

`@property (nonatomic, readwrite, assign) float startSpin`

#### Declared In

`CCParticleSystemBase.h`

### startSpinVar

Start spin variance of each particle.

`@property (nonatomic, readwrite, assign) float startSpinVar`

#### Declared In

`CCParticleSystemBase.h`

### tangentialAccel

Tangential acceleration of each particle. Only available in ‘Gravity’ mode.

`@property (nonatomic, readwrite, assign) float tangentialAccel`

#### Declared In

`CCParticleSystemBase.h`

### tangentialAccelVar

Tangential acceleration variance of each particle. Only available in ‘Gravity’ mode.

`@property (nonatomic, readwrite, assign) float tangentialAccelVar`

#### Declared In

`CCParticleSystemBase.h`

### totalParticles

Maxmium particles of the system.

`@property (nonatomic, readwrite, assign) NSUInteger totalParticles`

#### Declared In

`CCParticleSystemBase.h`

## Class Methods

### particleWithFile:

Creates and returns a particle system object from the specified plist source file.

`+ (id)particleWithFile:(NSString *)plistFile`

#### Parameters

plistFile

  Particle configuration file.

#### Return Value

The CCParticleSystem Object.

#### Declared In

`CCParticleSystemBase.h`

### particleWithTotalParticles:

Creates and returns an empty particle system object with the specified maxmium number of particles.

`+ (id)particleWithTotalParticles:(NSUInteger)numberOfParticles`

#### Parameters

numberOfParticles

  Maximum particles.

#### Return Value

The CCParticleSystem Object.

#### Declared In

`CCParticleSystemBase.h`

## Instance Methods

### initWithDictionary:

Initializes and returns a particle system object from the specified dictionary.

`- (id)initWithDictionary:(NSDictionary *)dictionary`

#### Parameters

dictionary

  Particle dictionary object.

#### Return Value

An initialized CCParticleSystem Object.

#### Declared In

`CCParticleSystemBase.h`

### initWithDictionary:path:

Initializes and returns a particle system object from the specified dictionary and texture directory path values.

`- (id)initWithDictionary:(NSDictionary *)dictionary path:(NSString *)dirname`

#### Parameters

dictionary

  Particle dictionary object.

dirname

  Path to dictionary

#### Return Value

An initialized CCParticleSystem Object.

#### Declared In

`CCParticleSystemBase.h`

### initWithFile:

Initializes and returns a particle system object from the specified plist source file.

`- (id)initWithFile:(NSString *)plistFile`

#### Parameters

plistFile

  Particle configuration file.

#### Return Value

An initialized CCParticleSystem Object.

#### Declared In

`CCParticleSystemBase.h`

### initWithTotalParticles:

Initializes and returns an empty particle system object with the specified maxmium number of particles.

`- (id)initWithTotalParticles:(NSUInteger)numberOfParticles`

#### Parameters

numberOfParticles

  Maximum particles.

#### Return Value

An initialized CCParticleSystem Object.

#### Declared In

`CCParticleSystemBase.h`

### resetSystem

Destroy all particles.

`- (void)resetSystem`

#### Declared In

`CCParticleSystemBase.h`

### stopSystem

Stop emitting new particles, existing particles will die off.

`- (void)stopSystem`

#### Declared In

`CCParticleSystemBase.h`