Scene ManagementTree NodesNodeOn this pageNode Description: Class used for building a hierarchical tree structure of game objects. Class Object: Node Class. Inherits from: Object. order Type: Field. Description: The order of the node in the parent's children array. Signature: order: integer angle Type: Field. Description: The rotation angle of the node in degrees. Signature: angle: number angleX Type: Field. Description: The X-axis rotation angle of the node in degrees. Signature: angleX: number angleY Type: Field. Description: The Y-axis rotation angle of the node in degrees. Signature: angleY: number scaleX Type: Field. Description: The X-axis scale factor of the node. Signature: scaleX: number scaleY Type: Field. Description: The Y-axis scale factor of the node. Signature: scaleY: number x Type: Field. Description: The X-axis position of the node. Signature: x: number y Type: Field. Description: The Y-axis position of the node. Signature: y: number z Type: Field. Description: The Z-axis position of the node. Signature: z: number position Type: Field. Description: The position of the node as a Vec2 object. Signature: position: Vec2 skewX Type: Field. Description: The X-axis skew angle of the node in degrees. Signature: skewX: number skewY Type: Field. Description: The Y-axis skew angle of the node in degrees. Signature: skewY: number visible Type: Field. Description: Whether the node is visible. Signature: visible: boolean anchor Type: Field. Description: The anchor point of the node as a Vec2 object. Signature: anchor: Vec2 width Type: Field. Description: The width of the node. Signature: width: number height Type: Field. Description: The height of the node. Signature: height: number size Type: Field. Description: The size of the node as a Size object. Signature: size: Size tag Type: Field. Description: The tag of the node as a string. Signature: tag: string opacity Type: Field. Description: The opacity of the node, should be 0 to 1.0. Signature: opacity: number color Type: Field. Description: The color of the node as a Color object. Signature: color: Color color3 Type: Field. Description: The color of the node as a Color3 object. Signature: color3: Color3 passOpacity Type: Field. Description: Whether to pass the opacity value to child nodes. Signature: passOpacity: boolean passColor3 Type: Field. Description: Whether to pass the color value to child nodes. Signature: passColor3: boolean transformTarget Type: Field. Description: The target node acts as a parent node for transforming this node. Signature: transformTarget: Node scheduler Type: Field. Description: The scheduler used for scheduling update and action callbacks. Signature: scheduler: Scheduler hasChildren Type: Readonly Field. Description: Whether the node has children. Signature: const hasChildren: boolean children Type: Readonly Field. Description: The children of the node as an Array object, could be nil. Signature: const children: Array parent Type: Readonly Field. Description: The parent node of the node. Signature: const parent: Node running Type: Readonly Field. Description: Whether the node is currently running in a scene tree. Signature: const running: boolean scheduled Type: Readonly Field. Description: Whether the node is currently scheduling a function or a coroutine for updates. Signature: const scheduled: boolean actionCount Type: Readonly Field. Description: The number of actions currently running on the node. Signature: const actionCount: integer data Type: Readonly Field. Description: Additional data stored on the node as a Dictionary object. Signature: const data: Dictionary touchEnabled Type: Field. Description: Whether touch events are enabled on the node. Signature: touchEnabled: boolean swallowTouches Type: Field. Description: Whether the node should swallow touch events. Signature: swallowTouches: boolean swallowMouseWheel Type: Field. Description: Whether the node should swallow mouse wheel events. Signature: swallowMouseWheel: boolean keyboardEnabled Type: Field. Description: Whether keyboard events are enabled on the node. Signature: keyboardEnabled: boolean controllerEnabled Type: Field. Description: Whether controller events are enabled on the node. Signature: controllerEnabled: boolean renderGroup Type: Field. Description: Whether to group the node's rendering with all its recursive children. Signature: renderGroup: boolean showDebug Type: Field. Description: Whether debug graphic should be displayed for the node. Signature: showDebug: boolean renderOrder Type: Field. Description: The rendering order number for group rendering. Nodes with lower rendering orders are rendered earlier. Signature: renderOrder: integer addChild Type: Function. Description: Adds a child node to the current node. Signature: addChild: function( self: Node, child: Node, order?: integer --[[0]], tag?: string --[[""]] ) Parameters: ParameterTypeDescriptionchildNodeThe child node to add.orderinteger[optional] The drawing order of the child node. Default is 0.tagstring[optional] The tag of the child node. Default is an empty string. addTo Type: Function. Description: Adds the current node to a parent node. Signature: addTo: function( self: Node, parent: Node, order?: integer --[[0]], tag?: string --[[""]] ): Node Parameters: ParameterTypeDescriptionparentNodeThe parent node to add the current node to.orderinteger[optional] The drawing order of the current node. Default is 0.tagstring[optional] The tag of the current node. Default is an empty string. Returns: Return TypeDescriptionNodeThe current node. removeChild Type: Function. Description: Removes a child node from the current node. Signature: removeChild: function( self: Node, child: Node, cleanup?: boolean --[[true]] ) Parameters: ParameterTypeDescriptionchildNodeThe child node to remove.cleanupboolean[optional] Whether to cleanup the child node. Default is true. removeChildByTag Type: Function. Description: Removes a child node from the current node by tag. Signature: removeChildByTag: function( self: Node, tag: string, cleanup?: boolean --[[true]] ) Parameters: ParameterTypeDescriptiontagstringThe tag of the child node to remove.cleanupboolean[optional] Whether to cleanup the child node. Default is true. removeAllChildren Type: Function. Description: Removes all child nodes from the current node. Signature: removeAllChildren: function( self: Node, cleanup?: boolean --[[true]] ) Parameters: ParameterTypeDescriptioncleanupboolean[optional] Whether to cleanup the child nodes. Default is true. removeFromParent Type: Function. Description: Removes the current node from its parent node. Signature: removeFromParent: function( self: Node, cleanup?: boolean --[[true]] ) Parameters: ParameterTypeDescriptioncleanupboolean[optional] Whether to cleanup the current node. Default is true. moveToParent Type: Function. Description: Moves the current node to a new parent node without triggering node events. Signature: moveToParent: function(self: Node, parent: Node) Parameters: ParameterTypeDescriptionparentNodeThe new parent node to move the current node to. cleanup Type: Function. Description: Cleans up the current node. Signature: cleanup: function(self: Node) getChildByTag Type: Function. Description: Gets a child node by tag. Signature: getChildByTag: function(self: Node, tag: string): Node Parameters: ParameterTypeDescriptiontagstringThe tag of the child node to get. Returns: Return TypeDescriptionNodeThe child node, or nil if not found. schedule Type: Function. Description: Schedules a main function to run every frame. Call this function again to replace the previous scheduled main function or coroutine. Signature: schedule: function(self: Node, func: function(number): boolean) Parameters: ParameterTypeDescriptionfuncfunctionThe main function to run, returns true to stop. schedule Type: Function. Description: Schedules a main coroutine to run. Call this function again to replace the previous scheduled main function or coroutine. Signature: schedule: function(self: Node, job: Routine.Job) Parameters: ParameterTypeDescriptionjobRoutine.JobThe main coroutine to run, return or yield true to stop. unschedule Type: Function. Description: Unschedules the current node's scheduled main function or coroutine. Signature: unschedule: function(self: Node) once Type: Function. Description: Schedules a function that runs in a coroutine once. Call this function to replace the previous scheduled main function or coroutine. Signature: once: function(self: Node, func: function()) Parameters: ParameterTypeDescriptionfuncfunctionThe function to run once. loop Type: Function. Description: Schedules a function that runs in a coroutine in a loop. Call this function to replace the previous scheduled main function or coroutine. Signature: loop: function(self: Node, func: function(): boolean) Parameters: ParameterTypeDescriptionfuncfunctionThe function to run in a loop, returns true to stop. convertToNodeSpace Type: Function. Description: Converts a point in world space to node space. Signature: convertToNodeSpace: function(self: Node, worldPoint: Vec2): Vec2 Parameters: ParameterTypeDescriptionworldPointVec2The point to convert. Returns: Return TypeDescriptionVec2The converted point. convertToNodeSpace Type: Function. Description: Converts a point in world space to node space. Signature: convertToNodeSpace: function(self: Node, worldPoint: Vec2, z: number): Vec2, number Parameters: ParameterTypeDescriptionworldPointVec2The point to convert.znumberThe z-coordinate of the point. Returns: Return TypeDescriptionVec2The converted point.numberThe converted z-coordinate. convertToWorldSpace Type: Function. Description: Converts a point from node space to world space. Signature: convertToWorldSpace: function(self: Node, nodePoint: Vec2): Vec2 Parameters: ParameterTypeDescriptionnodePointVec2The point in node space. Returns: Return TypeDescriptionVec2The converted point in world space. convertToWorldSpace Type: Function. Description: Converts a point from node space to world space. Signature: convertToWorldSpace: function(self: Node, nodePoint: Vec2, z: number): Vec2, number Parameters: ParameterTypeDescriptionnodePointVec2The point in node space.znumberThe z coordinate in node space. Returns: Return TypeDescriptionVec2The converted point in world space.numberThe converted z coordinate in world space . convertToWindowSpace Type: Function. Description: Converts a point from node space to window space. Signature: convertToWindowSpace: function(self: Node, nodePoint: Vec2, callback: function(Vec2)) Parameters: ParameterTypeDescriptionnodePointVec2The point in node space.callbackfunctionThe callback function to receive the converted point in window space. eachChild Type: Function. Description: Calls the given function for each child node of this node. Signature: eachChild: function(self: Node, func: function(Node): boolean): boolean Parameters: ParameterTypeDescriptionfuncfunctionThe function to call for each child node. The function should return a boolean value indicating whether to continue the iteration. Return true to stop iteration. Returns: Return TypeDescriptionbooleanFalse if all children have been visited, true if the iteration was interrupted by the function. traverse Type: Function. Description: Traverses the node hierarchy starting from this node and calls the given function for each visited node. The nodes without TraverseEnabled flag are not visited. Signature: traverse: function(self: Node, func: function(Node): boolean): boolean Parameters: ParameterTypeDescriptionfuncfunctionThe function to call for each visited node. The function should return a boolean value indicating whether to continue the traversal. Return true to stop iteration. Returns: Return TypeDescriptionbooleanFalse if all nodes have been visited, true if the traversal was interrupted by the function. traverseAll Type: Function. Description: Traverses the entire node hierarchy starting from this node and calls the given function for each visited node. Signature: traverseAll: function(self: Node, func: function(Node): boolean): boolean Parameters: ParameterTypeDescriptionfuncfunctionThe function to call for each visited node. The function should return a boolean value indicating whether to continue the traversal. Returns: Return TypeDescriptionbooleanTrue if all nodes have been visited, false if the traversal was interrupted by the function. runAction Type: Function. Description: Runs the given action on this node. Signature: runAction: function(self: Node, action: Action, loop?: boolean): number Parameters: ParameterTypeDescriptionactionActionThe action to run.loopboolean[optional] Whether to loop the action. Default is false. Returns: Return TypeDescriptionnumberThe duration of the newly running action in seconds. runAction Type: Function. Description: Runs an action defined by the given action definition on this node. Signature: runAction: function(self: Node, actionDef: ActionDef, loop?: boolean): number Parameters: ParameterTypeDescriptionactionDefActionDefThe action definition to run.loopboolean[optional] Whether to loop the action. Default is false. Returns: Return TypeDescriptionnumberThe duration of the newly running action in seconds. stopAllActions Type: Function. Description: Stops all actions running on this node. Signature: stopAllActions: function(self: Node) perform Type: Function. Description: Runs the given action immediately without adding it to the action queue. Signature: perform: function(self: Node, action: Action, loop?: boolean): number Parameters: ParameterTypeDescriptionactionActionThe action to run.loopboolean[optional] Whether to loop the action. Default is false. Returns: Return TypeDescriptionnumberThe duration of the newly running action. perform Type: Function. Description: Runs an action defined by the given action definition right after clear all the previous running actions. Signature: perform: function(self: Node, actionDef: ActionDef, loop?: boolean): number Parameters: ParameterTypeDescriptionactionDefActionDefThe action definition to run.loopboolean[optional] Whether to loop the action. Default is false. Returns: Return TypeDescriptionnumberThe duration of the newly running action. stopAction Type: Function. Description: Stops the given action running on this node. Signature: stopAction: function(self: Node, action: Action) Parameters: ParameterTypeDescriptionactionActionThe action to stop. alignItemsVertically Type: Function. Description: Vertically aligns all child nodes of this node. Signature: alignItemsVertically: function( self: Node, padding?: number --[[10]] ): Size Parameters: ParameterTypeDescriptionpaddingnumber[optional] The padding between child nodes. Defaults to 10. Returns: Return TypeDescriptionSizeThe size of the aligned child nodes. alignItemsVertically Type: Function. Description: Vertically aligns all child nodes within the node using the given size and padding. Signature: alignItemsVertically: function( self: Node, size: Size, padding?: number --[[10]] ): Size Parameters: ParameterTypeDescriptionsizeSizeThe size to use for alignment.paddingnumber[optional] The amount of padding to use between each child node (default is 10). Returns: Return TypeDescriptionSizeThe size of the node after alignment. alignItemsHorizontally Type: Function. Description: Horizontally aligns all child nodes within the node using the given padding. Signature: alignItemsHorizontally: function( self: Node, padding?: number --[[10]] ): Size Parameters: ParameterTypeDescriptionpaddingnumber[optional] The amount of padding to use between each child node (default is 10). Returns: Return TypeDescriptionSizeThe size of the node after alignment. alignItemsHorizontally Type: Function. Description: Horizontally aligns all child nodes within the node using the given size and padding. Signature: alignItemsHorizontally: function( self: Node, size: Size, padding?: number --[[10]] ): Size Parameters: ParameterTypeDescriptionsizeSizeThe size to hint for alignment.paddingnumber[optional] The amount of padding to use between each child node (default is 10). Returns: Return TypeDescriptionSizeThe size of the node after alignment. alignItems Type: Function. Description: Aligns all child nodes within the node using the given size and padding. Signature: alignItems: function( self: Node, padding?: number --[[10]] ): Size Parameters: ParameterTypeDescriptionpaddingnumber[optional] The amount of padding to use between each child node (default is 10). Returns: Return TypeDescriptionSizeThe size of the node after alignment. alignItems Type: Function. Description: Aligns all child nodes within the node using the given size and padding. Signature: alignItems: function( self: Node, size: Size, padding?: number --[[10]] ): Size Parameters: ParameterTypeDescriptionsizeSizeThe size to use for alignment.paddingnumber[optional] The amount of padding to use between each child node (default is 10). Returns: Return TypeDescriptionSizeThe size of the node after alignment. moveAndCullItems Type: Function. Description: Moves and changes child nodes' visibility based on their position in parent's area. Signature: moveAndCullItems: function(self: Node, delta: Vec2) Parameters: ParameterTypeDescriptiondeltaVec2The distance to move its children. attachIME Type: Function. Description: