Interface GameObjectOptions

For configuring basic properties of a GameObject

GameObjectOptions

Example

 const options: GameObjectOptions = {
physicsEnabled: true,
physicsOptions: {
restitution: 0.5
}
interface GameObjectOptions {
    _state?: any;
    backgroundColor?: string;
    blocks?: GameObject[];
    bounds?: Vec2;
    boundsActive?: boolean;
    convex?: boolean;
    coordinates?: Vec2;
    gameObjectOptions?: GameObjectOptions;
    hitbox?: Vec2;
    id?: string;
    meta?: any;
    physicsEnabled?: boolean;
    physicsOptions?: PhysicsOptions;
    points?: Vec2[];
    square?: boolean;
    type?: string;
}

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

Set the coordinates of the GameObject, by default coordinates are [0, 0]

gameObjectOptions?: GameObjectOptions

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

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"

Generated using TypeDoc