@moxijs/core - v0.3.4
    Preparing search index...

    Class Logic<T>Abstract

    Base class for entity behavior. Extend to add custom logic.

    class MoveRight extends Logic<PIXI.Sprite> {
    speed = 100;
    update(entity, dt) { entity.x += this.speed * dt; }
    }

    sprite.moxiEntity.addLogic(new MoveRight());

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    active: boolean = true

    Set false to skip update() calls.

    name?: string

    Identifier for getLogic(). Defaults to class name.

    Methods

    • Called once when scene.init() is invoked. Override for setup.

      Parameters

      • Optionalentity: T

        The PIXI object this logic is attached to

      • Optionalrenderer: Renderer<HTMLCanvasElement>

        The PIXI renderer

      • ...args: any[]

        Additional arguments passed to scene.init()

      Returns void

    • Called every frame while active. Override for behavior.

      Parameters

      • Optionalentity: T

        The PIXI object this logic is attached to

      • OptionaldeltaTime: number

        Time since last frame in frames (1 = 1/60s at 60fps)

      Returns void