• Public
  • Public/Protected
  • All

Interface ActorArgs

Constructor Arguments

In Excalibur there are option bag constructors available on most types. These support any public property or member, methods are not supported. The API documentation does not provide an exhaustive list of possible properties but a list of commonly used properties.

For example instead of doing this:

const actor = new ex.Actor(1, 2, 100, 100, ex.Color.Red);
actor.body.collider.type = ex.CollisionType.Active;

This is possible:

const options: IActorArgs = {
   pos: new ex.Vector(1,2);
   width: 100,
   height: 100,
   color: ex.Color.Red,

const actor = new ex.Actor(options);
actor.body.collider.type = ex.CollisionType.Active;

In fact you can create a duplicate this way

const actor = new ex.Actor({
  pos: new ex.Vector(1, 2)
const actorClone = new ex.Actor(actor);

expect(actor.pos).toBe(actorClone.pos); // true;

Types that support option bags can have their properties mass assigned using the assign method.

const actor = new ex.Actor(options);

  pos: new ex.Vector(100, 100),
  width: 1000,
  color: ex.Color.Red



  • object
    • ActorArgs



Optional acc

acc: Vector

Optional body

body: Body

Optional collisionType

collisionType: CollisionType

Optional color

color: Color

Optional height

height: number

Optional pos

pos: Vector

Optional rotation

rotation: number

Optional rx

rx: number

Optional vel

vel: Vector

Optional visible

visible: boolean

Optional width

width: number

Optional x

x: number

Optional y

y: number

Optional z

z: number