Interface TGameObject<TSprite, TBody>

interface TGameObject<TSprite, TBody> {
    body: TBody;
    children: LifecycleProps[];
    destroy$: Subject<void>;
    gameObject?: GameObjectParent;
    label: string;
    sprite: TSprite;
    target?: Vector;
    update$: Subject<number>;
    x: number;
    y: number;
    get scene(): SceneType;
    addChild(...children: LifecycleProps[]): void;
    destroy(): void;
    getChildOfType(type: string): LifecycleProps;
    getChildrenOfType(type: string): LifecycleProps[];
    recursive(child: LifecycleProps, callback: ((deep: LifecycleProps) => void)): void;
    removeChild(...children: LifecycleProps[]): void;
    update(deltaTime: number): void;
}

Type Parameters

Hierarchy (view full)

Properties

body: TBody
children: LifecycleProps[] = []

Lifecycles can have children Lifecycles

destroy$: Subject<void> = ...

When Lifecycle Object is destroyed, it emits and closes this subject. Along with destroying his children, which in turn behave the same.

gameObject?: GameObjectParent

Lifecycle Object may be added to a Scene Object.

label: string

Each Lifecycle Object has label for pixi debugging.

sprite: TSprite
target?: Vector
update$: Subject<number> = ...

When Lifecycle Object is updated, it emits this subject. Along with updating his children, which in turn behave the same.

x: number

position x

y: number

position y

Accessors

Methods