### Navigation

- index
- modules |
- next |
- previous |
- cocos »
- cocos package »

# cocos.particle module

Particle system engine

exception `ExceptionNoEmptyParticle`

  Bases: `exceptions.Exception`

  particle system have no room for another particle

class `Color`(r, g, b, a)

  Bases: `object`

  `to_array`()

class `ParticleSystem`(fallback=None)

  Bases: `cocos.cocosnode.CocosNode`

  Base class for many flawors of cocos particle systems

  The most easy way to customize is subclass and redefine some class members; see particle_systems by example.

  If you want to use a custom texture remember it should hold only one image, so don’t use texture = pyglet.resource.image(...) (it would produce an atlas, ie multiple images in a texture); using texture = pyglet.image.load(...) is fine

  `add_particle`()
    Code calling add_particle must be either:
      be sure there is room for the particle or be prepared to catch the exception ExceptionNoEmptyParticle It is acceptable to try: ... except...: pass
  `draw`()
  `draw_fallback`()
  `get_scaled_particle_size`()

    calcultes the value to pass in glPointSize to respect node scaling and window resize; only used when rendering with point sprites.

  `init_particle`()
  `make_delta_pos_to_vertex`()
  `on_enter`()
  `reset_system`()
  `step`(delta)
  `stop_system`()
  `update_particles`(delta)
  `update_per_vertex_colors`()
  `update_vertexs_from_pos`()
  `POSITION_FREE` = 0
  `POSITION_GROUPED` = 1
  `active` = True

    is the particle system active ?

  `angle` = 0.0

    The angle (direction) of the particles measured in degrees

  `angle_var` = 0.0

    Angle variance measured in degrees;

  `auto_remove_on_finish` = None

    auto remove when particle finishes

  `blend_additive` = False

    blend additive

  `color_modulate` = True

    color modulate

  `duration` = 0

    duration in seconds of the system. -1 is infinity

  `elapsed` = 0

    time elapsed since the start of the system (in seconds)

  `emit_counter` = None

    How many particles can be emitted per second

  `end_color` = <cocos.particle.Color object at 0x066D9710>

    End color of the particles

  `end_color_var` = <cocos.particle.Color object at 0x066D9730>

    End color variance

  `gravity` = Point2(0.00, 0.00)

    Gravity of the particles

  `life` = 0

    How many seconds will the particle live

  `life_var` = 0

    Life variance

  `particle_count` = None

    Count of particles

  `pic` = <ImageData 128x128>

    texture for the particles

  `pos_var` = Point2(0.00, 0.00)

    position is from “superclass” CocosNode Position variance

  `position_type` = 1
  `radial_accel` = 0.0

    Radial acceleration

  `radial_accel_var` = 0.0

    Radial acceleration variance

  `size` = 0.0

    Size of the particles

  `size_var` = 0.0

    Size variance

  `speed` = 0.0

    The speed the particles will have.

  `speed_var` = 0.0

    The speed variance

  `start_color` = <cocos.particle.Color object at 0x066D92B0>

    Start color of the particles

  `start_color_var` = <cocos.particle.Color object at 0x066D96F0>

    Start color variance

  `tangential_accel` = 0.0

    Tangential acceleration

  `tangential_accel_var` = 0.0

    Tangential acceleration variance

  `texture` = <Texture 128x128>
  `total_particles` = 0

    Maximum particles

`PointerToNumpy`(a, ptype=<class 'ctypes.c_float'>)

`point_sprites_available`()

  returns a bool telling if point sprites are available

  For development and diagonostic cocos.particle.forced_point_sprites could be set to force the desired return value

`rand`()

### Navigation

- index
- modules |
- next |
- previous |
- cocos »
- cocos package »