Interface SpriteOptions

For configuring the properties of a sprite

SpriteOptions

Example

 const options: SpriteOptions = {
url: "https://i.imgur.com/0xq2Mgj.png",
coordinates: [0, 0],
width: 100,
height: 100
}
interface SpriteOptions {
    _state?: any;
    backgroundColor?: string;
    blocks?: GameObject[];
    bounds?: Vec2;
    boundsActive?: boolean;
    convex?: boolean;
    coordinates: Vec2;
    gameObjectOptions?: GameObjectOptions;
    height: number;
    hitbox?: Vec2;
    id?: string;
    meta?: any;
    physicsEnabled?: boolean;
    physicsOptions?: PhysicsOptions;
    points?: Vec2[];
    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})

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

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

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