Actors > Draw


Animation

Current Animation

current animation for actor

Returns the current animation for the actor.

[ACTOR].getAnimation()

Switch Animation

switch animation to animation for actor

Changes the animation for the actor to the specified one.

[ACTOR].setAnimation([ANIMATION]);

Is an Animation playing?

is animation playing for actor

Returns true if the actor's current animation is still playing. This is only relevant for non-looping animations since looping ones will always return true.

[ACTOR].isAnimationPlaying()

Set Frame # for Animation

switch to frame int for actor

Sets the frame (by index) for the actor's current animation.

[ACTOR].setCurrentFrame([INT]);

Get Current Frame

get current frame for actor

Returns the index of the current frame in the actor's current animation.

[ACTOR].getCurrentFrame()

Get Number of Frames in Current Animation

get frame count for actor

Returns the number of frames in the actor's current animation.

[ACTOR].getNumFrames()

Get Duration of Current Frame

duration of frame int for actor

Returns the duration (in milliseconds) of the current frame in the actor's current animation.

[ACTOR].currAnimation.getFrameDurations()[[INT]]

Set Duration of Current Frame

set duration of frame int to int for actor

Sets the duration (in milliseconds) of the current frame in the actor's current animation.

[ACTOR].currAnimation.setFrameDuration([INT], [INT]);

Layer (Z-Order)

Get Layer ID

layer id of actor

Returns the ID of the layer that this actor is part of.

[ACTOR].getLayerID()

Get Layer Name

layer name of actor

Returns the name of the layer that this actor is part of.

[ACTOR].getLayerName()

Switch Layer by ID / Name

send actor to layer with id object

Changes an actor's layer by either specifying the Layer ID or Layer Name. You can find both pieces of info in the Scene Designer's Layers Pane.

[ACTOR].moveToLayer(engine.getLayerById([INT]));
[ACTOR].moveToLayer(engine.getLayerByName([TEXT]));

Switch Layer

send actor back a layer

A user-friendly way of making adjustments to an actor's layer. Can move to front/back/forward 1 layer/back 1 layer.

[ACTOR].sendBackward();
[ACTOR].bringForward();
[ACTOR].sendToBack();
[ACTOR].bringToFront();

Switch Drawing Order (within layer)

move actor down within the layer

A user-friendly way of making adjustments to an actor's drawing order (z-order) within a layer. Can move to front/back/forward 1 layer/back 1 layer.

[ACTOR].moveDown();
[ACTOR].moveUp();
[ACTOR].moveToBottom();
[ACTOR].moveToTop();

Get Drawing Order (within layer)

z index of actor within the layer

Returns an actor's drawing order (z-order) within its layer.

[ACTOR].getZIndex()

Set Drawing Order (within layer)

set z index within the layer of actor to int

Sets an actor's drawing order (z-order) within its layer. This lets you make fine-tuned adjustments to layering without introducing a more layers to the game.

[ACTOR].setZIndex([INT]);

Number of Actors within Layer

number of actors within the layer with id object

Returns the number of actors in the specified actor's layer. Can specify by Layer ID or Layer Name. You can find both pieces of info in the Scene Designer's Layers Pane.

engine.getNumberOfActorsWithinLayer(engine.getLayerById([INT]))
engine.getNumberOfActorsWithinLayer(engine.getLayerByName([TEXT]))

Drawing

Show / Hide Sprite

show sprite for actor

Makes the actor invisible or visible. Everything else about the actor still works, and the [actor] is on screen block will still return true.

[ACTOR].enableActorDrawing();
[ACTOR].disableActorDrawing();

Set Opacity

set opacity of actor to number %

Sets the actor's opacity (alpha) value, which controls how "transparent" the actor is. Value must be between [0 - 100] inclusive. 0 means fully transparent. 100 is the default.

[ACTOR].alpha = [NUMBER] / 100;

Get Opacity

opacity of actor

Returns the actor's opacity (alpha) value as a value between [0 - 100] inclusive.

([ACTOR].alpha * 100)

Anchoring

Anchor Actor to Screen

anchor actor to screen

Moves the actor to the HUD layer, which is on top of all regular layers. The actor will ignore the camera, so when the screen scrolls, the actor will still remain in the same place.

[ACTOR].anchorToScreen();

Unanchor Actor from Screen

unanchor actor from screen

Moves the actor back from the HUD layer.

[ACTOR].unanchorFromScreen();