Interface ParticleOptions

ParticleOptions

Example

 const particles = new Particles({
url: "https://i.imgur.com/9Nc8fFp.png",
coordinates: [0, 0],
width: 100,
height: 100,
spread: Math.PI * 2,
speed: 1,
life: 500,
angle: Math.PI / 2,
lifeVariability: 0,
spawnRate: 50
});
interface ParticleOptions {
    _state?: any;
    angle?: number;
    backgroundColor?: string;
    blocks?: GameObject[];
    bounds?: Vec2;
    boundsActive?: boolean;
    convex?: boolean;
    coordinates: Vec2;
    gameObjectOptions?: GameObjectOptions;
    height: number;
    hitbox?: Vec2;
    id?: string;
    life?: number;
    lifeVariability?: number;
    meta?: any;
    physicsEnabled?: boolean;
    physicsOptions?: PhysicsOptions;
    points?: Vec2[];
    spawnRate?: number;
    speed?: number;
    spread?: number;
    square?: boolean;
    type?: string;
    url: string;
    width: number;
}

Hierarchy (view full)

Properties

_state?: any

Internal state of the GameObject, do not modify, but you can pass an initial state to the GameObject (use "_state": { ...gameObject, ...newProperties})

angle?: number

The angle of the particles (in radians)

backgroundColor?: string

CSS color, background color of the GameObject (only applies to polygons)

blocks?: GameObject[]

Array of GameObjects that are blocked by this GameObject

bounds?: Vec2

Set the bounds of the GameObject, by default bounds are not enabled

boundsActive?: boolean

Set to true to enable bounds, default is false

convex?: boolean

Set to true to make the GameObject convex, default is false

coordinates: Vec2

Initial coordinates of the sprite

gameObjectOptions?: GameObjectOptions

Options for the GameObject (applied to clones when cloned using GameObject.From())

height: number

Height of the sprite

hitbox?: Vec2

Set the hitbox of the GameObject, by default hitbox is not enabled

id?: string

A unique id for the GameObject, generated automatically by default

life?: number

The life of the particles (in milliseconds)

lifeVariability?: number

The variability of the life of the particles (in milliseconds)

meta?: any

Any meta data you want to store in the GameObject (Do not overwrite "label", "player", or "id" if you are using a MultiPlayerSceneManager)

physicsEnabled?: boolean

Set to true to enable physics, default is false

physicsOptions?: PhysicsOptions

Options passed to matter.js engine

points?: Vec2[]

Set the points of the GameObject, by default points are not enabled

spawnRate?: number

The spawn rate of the particles (in milliseconds)

speed?: number

The speed of the particles (in pixels per tick)

spread?: number

The spread of the particles (in radians)

square?: boolean

Set to true to make the GameObject a square, default is false

type?: string

Set the type of the GameObject, by defualt is "gameObject", "polygon", or "sprite"

url: string

Url of the image

width: number

Width of the sprite

Generated using TypeDoc