Options
All
  • Public
  • Public/Protected
  • All
Menu

A particle system which contains particles that update themselves

Hierarchy

  • ParticleSystem

Index

Constructors

constructor

  • Parameters

    • width: number

      Height of the particle system, typically in pixels

    • height: number

      Width of the particle system, typically in pixels

    Returns ParticleSystem

Properties

Readonly PARTICLE_LIFETIME

PARTICLE_LIFETIME: 40 = 40

Readonly PARTICLE_POOL_SIZE

PARTICLE_POOL_SIZE: 2000 = 2000

Private height

height: number

Private lastUpdate

lastUpdate: number = 0

Private oldestParticle

oldestParticle: number = 0

Readonly particles

particles: readonly Readonly<Particle>[]

Private width

width: number

Methods

createParticle

  • createParticle(x: number, y: number, vx: number, vy: number): void
  • Creates a new particle

    Parameters

    • x: number

      Particle's x position, in pixels

    • y: number

      Particle's y position, in pixels

    • vx: number

      Particle's x velocity, in pixels per 1/60th of a second

    • vy: number

      Particle's y velocity, in pixels per 1/60th of a second

    Returns void

createParticleBurst

  • createParticleBurst(x: number, y: number, v: number, n: number): void
  • Creates a burst of particles exploding out in a circle from a single point

    Parameters

    • x: number

      The x coordinate of the emanation point

    • y: number

      The y coordinate of the emanation point

    • v: number

      The velocity of the particles, in pixels per 1/60th of a second

    • n: number

      The number of particles to create

    Returns void

setSize

  • setSize(newWidth: number, newHeight: number): void
  • Update the size of the particle system.

    Parameters

    • newWidth: number

      New width in pixels

    • newHeight: number

      New height in pixels

    Returns void

update

  • update(): void
  • Updates all particle positions based on their current position, velocity, and the amount of time that's passed.

    Returns void

Generated using TypeDoc