Scenes > Actors


Create Actor

Create Actor

create actortype at x number y number at front

Creates an actor at the specified position.

createRecycledActor([ACTOR TYPE], [NUMBER], [NUMBER], Script.FRONT);
createRecycledActor([ACTOR TYPE], [NUMBER], [NUMBER], Script.MIDDLE);
createRecycledActor([ACTOR TYPE], [NUMBER], [NUMBER], Script.BACK);

Create Actor on Layer

create actortype at x number y number on layer with id object

Creates an actor at the specified position and layer (given a Layer ID or Name).

createRecycledActorOnLayer([ACTOR TYPE], [NUMBER], [NUMBER], engine.getLayerById([INT]));
createRecycledActorOnLayer([ACTOR TYPE], [NUMBER], [NUMBER], engine.getLayerByName([TEXT]));

Get Actor

Get Actor Instance

actor

Let you choose a specific actor instance to return.

[ACTOR]

For Each Actor On Screen ...

for each

Loops over all actors on the screen. Use the embedded actor on screen block to refer to each actor.

engine.allActors.reuseIterator = false;
for(actorOnScreen in engine.allActors) {
  if(actorOnScreen != null && !actorOnScreen.dead && !actorOnScreen.recycled && actorOnScreen.isOnScreenCache) {
    [ACTIONS]
  }
}
engine.allActors.reuseIterator = true;

For Each Actor in Region ...

for each region

Loops over all actors inside the specified region. Use the embedded actor within region block to refer to each actor.

for(actorInRegion in getActorsInRegion([REGION])) {
  if(actorInRegion != null && !actorInRegion.dead) {
    [ACTIONS]
  }
}

For Each Actor of Type ...

for each actortype

Loops over all actors of a given Actor Type (whether on or off screen). Use the embedded actor of type block to refer to each actor.

for(actorOfType in getActorsOfType([ACTOR TYPE])) {
  if(actorOfType != null && !actorOfType.dead && !actorOfType.recycled) {
    [ACTIONS]
  }
}

For Each Actor of Actor Group ...

for each actorgroup

Loops over all actors inside the specified Actor Group (whether on or off screen). Use the embedded actor of group block to refer to each actor.

for(actorInGroup in [ACTOR GROUP].list) {
  if(actorInGroup != null && !actorInGroup.dead && !actorInGroup.recycled) {
    [ACTIONS]
  }
}