ElixirQuake.Particles (elixir_quake v0.1.0)

Copy Markdown View Source

Quake's particles: blood and puffs, explosions, lava and teleport splashes, and the trails behind rockets, grenades, gibs and magic missiles, each moving by its kind and dying at its time.

particles = ElixirQuake.Particles.effect([], origin, direction, colour, count, now)
particles = ElixirQuake.Particles.run(particles, seconds, now)

Summary

Functions

A tarbaby's burst: 1024 particles in two colours.

count particles of palette colour colour thrown from origin along direction; 1024 is an explosion.

A rocket's explosion: 1024 particles flying out and cooling.

Lava thrown up in a square around origin.

Move every particle on by seconds and drop those whose time is up at now.

The sparkle of a teleport arriving at origin.

A trail from from to to: :rocket, :smoke, :blood, :tracer, :slight_blood, :tracer2 or :voor.

Types

particle()

@type particle() :: %{
  origin: tuple(),
  velocity: tuple(),
  colour: byte(),
  die: float(),
  kind: atom(),
  ramp: float()
}

Functions

blob(particles, origin, now)

@spec blob([particle()], tuple(), float()) :: [particle()]

A tarbaby's burst: 1024 particles in two colours.

effect(particles, origin, arg3, colour, count, now)

@spec effect([particle()], tuple(), tuple(), integer(), integer(), float()) :: [
  particle()
]

count particles of palette colour colour thrown from origin along direction; 1024 is an explosion.

explosion(particles, origin, now)

@spec explosion([particle()], tuple(), float()) :: [particle()]

A rocket's explosion: 1024 particles flying out and cooling.

lava(particles, arg, now)

@spec lava([particle()], tuple(), float()) :: [particle()]

Lava thrown up in a square around origin.

run(particles, seconds, now)

@spec run([particle()], float(), float()) :: [particle()]

Move every particle on by seconds and drop those whose time is up at now.

teleport(particles, arg, now)

@spec teleport([particle()], tuple(), float()) :: [particle()]

The sparkle of a teleport arriving at origin.

trail(particles, from, to, kind, now)

@spec trail([particle()], tuple(), tuple(), atom(), float()) :: [particle()]

A trail from from to to: :rocket, :smoke, :blood, :tracer, :slight_blood, :tracer2 or :voor.