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);