Skip to main content

MotionSystem

An Excalibur System that updates entities of certain types. Systems are scene specific

Excalibur Systems currently require at least 1 Component type to operated

Multiple types are declared as a type union For example:

class MySystem extends System {
  static priority = SystemPriority.Lowest;
  public readonly systemType = SystemType.Update;
  public query: Query<typeof TransformComponent>;
  constructor(public world: World) {
  super();
     this.query = this.world.query([TransformComponent]);
  }
  public update(elapsed: number) {
     ...
  }
}

Hierarchy

Index

Constructors

constructor

Properties

publicphysics

physics: PhysicsWorld

query

query: Query<typeof TransformComponent | typeof MotionComponent>

publicsystemType

systemType: SystemType = SystemType.Update

Determine whether the system is called in the SystemType.Update or the SystemType.Draw phase. Update is first, then Draw.

publicworld

world: World

staticpriority

priority: -5 = SystemPriority.Higher

System can execute in priority order, by default all systems are priority 0. Lower values indicated higher priority. For a system to execute before all other a lower priority value (-1 for example) must be set. For a system to execute after all other a higher priority value (10 for example) must be set.

Methods

captureOldTransformWithChildren

  • captureOldTransformWithChildren(entity: Entity): void
  • Parameters

    Returns void

optionalinheriteddispose

  • Optionally specify a dispose handler, called when the system is removed from the SystemManager after having been initialized. Use it to release any resources the system provisioned in initialize (entities it added, observable subscriptions, etc.)


    Parameters

    Returns void

optionalinheritedinitialize

  • Optionally specify an initialize handler


    Parameters

    Returns void

optionalinheritedpostupdate

  • postupdate(scene: Scene, elapsed: number): void
  • Optionally run a postupdate after the system processes matching entities


    Parameters

    • scene: Scene
    • elapsed: number

      Time in milliseconds since the last frame

    Returns void

optionalinheritedpreupdate

  • preupdate(scene: Scene, elapsed: number): void
  • Optionally run a preupdate before the system processes matching entities


    Parameters

    • scene: Scene
    • elapsed: number

      Time in milliseconds since the last frame

    Returns void

update

  • update(elapsed: number): void
  • Update all entities that match this system's types


    Parameters

    • elapsed: number

      Time in milliseconds

    Returns void