Skip to content

FxObject2D ​

This module provides functions for nodes that inherit from Object2D.

Load ​

lua
FxObject2D = require "FxObject2D";

Functions ​

FunctionDescription
Parent (NodeID, NewParentID)Parents a node to a new parent and preserves its world transformations.
Translate (NodeID, X, Y)Offsets the position of a node.

Parent (NodeID, NewParentID) ​

This function will parent the specified node to the new parent, i.e. it will become a child node of the new parent. The local translation is also adjusted so that the absolute position doesn't change.

Parameters ​

  • NodeID: The NodeID of the Object2D node to parent to another node
  • NewParentID: The NodeID of the new parent

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND, FX_VALUE_INVALID

Since ​

Version 1.0

Example ​

lua
-- make layer1 a child node of layer2
FxObject2D.Parent("layer1", "layer2");

Translate (NodeID, X, Y) ​

This function translates the specified nodes which means their positions are offset.

Parameters ​

  • NodeID: The NodeID to identify the Object2D nodes to be translated
  • X: The horizontal offset
  • Y: The vertical offset

Since ​

Version 1.0

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Example ​

lua
FxObject2D.Translate("layer1", 10, 2);