Drawing > Transforms


Transforms

Move Pen (Drawing Origin)

move pen by x number y number

Moves the origin point of drawing to or by the specified amount.

To = Sets to the specified amount.
By = Adds the specified amount to the existing amount.

g.translate([NUMBER], [NUMBER]);
g.moveTo([NUMBER], [NUMBER]);

Space Conversion

Switch to Screen Space

switch to screen space

By default, when drawing on actors, the coordinates are relative to the actor. This blocks switches the origin point of drawing to screen coordinates. This allows you to draw HUD's and other graphics that are anchored to the screen (and are unaffected by the camera).

g.translateToScreen();

Switch to Actor Space

switch to actor space for actor

Moves the origin point of the drawing to match the position of the specified actor.

g.translateToActor([ACTOR]);

Drawing Layer

Set Drawing Layer

set drawing to layer id object

Set the layer for drawing.

Script.setDrawingLayer(engine.getLayerById([INT]));
Script.setDrawingLayer(engine.getLayerByName([TEXT]));

Draw on Scene

set drawing to scene layer

Set the layer for drawing to the HUD layer, above all other layers.

Script.setDrawingLayerToSceneLayer();

Draw on Layer with Actor

set drawing to layer of actor

Set the layer for drawing to the layer with the specified actor.

Script.setDrawingLayerToActorLayer([ACTOR]);