gale.particle_system module

This file contains the classes Particle (a single point with position/acceleration/velocity/lifetime, using numpy for the physics integration) and ParticleSystem, spawning and managing bursts of them — explosions, sparks, trails, and similar effects.

Author: Alejandro Mujica (aledrums@gmail.com)

class gale.particle_system.Particle(x, y, ax, ay, life_time, color)[source]

Bases: object

Parameters:
  • x (float)

  • y (float)

  • ax (float)

  • ay (float)

  • life_time (float)

  • color (Color)

update(dt)[source]
Parameters:

dt (float)

Return type:

None

render(surface)[source]
Parameters:

surface (Surface)

Return type:

None

class gale.particle_system.ParticleSystem(x, y, n, on_finish=None)[source]

Bases: object

Parameters:
  • x (float)

  • y (float)

  • n (int)

  • on_finish (Callable[[], None] | None)

set_life_time(minimum, maximum)[source]
Parameters:
  • minimum (float)

  • maximum (float)

Return type:

None

set_linear_acceleration(x1, y1, x2, y2)[source]
Parameters:
  • x1 (float)

  • y1 (float)

  • x2 (float)

  • y2 (float)

Return type:

None

set_colors(colors)[source]
Parameters:

colors (List[Color])

Return type:

None

set_area_spread(rx, ry)[source]
Parameters:
  • rx (float)

  • ry (float)

Return type:

None

generate()[source]
Return type:

None

update(dt)[source]
Parameters:

dt (float)

Return type:

None

render(surface)[source]
Parameters:

surface (Surface)

Return type:

None