scene.copy(src, dest) | This is an internal function |
scene.destroy(t) | This is an internal function |
scene.new(t, ...) | This is an internal function |
scene.newCamera(x, y) | Creates a new camera object. Alternatively, you can use layer:newCamera. |
scene.newLayer(x, y) | Creates a new layer object. Alternatively, you can use layer:newLayer. |
scene.newSprite(x, y) | Creates a new sprite object. Alternatively, you can use layer:newSprite. |
scene.newView(x, y, width, height) | Creates a new view object. If no parameters are supplied, the view takes on the dimensions of the window. |
node | src Source node |
node | dest Destination node |
node | t Existing node |
node | t Existing node |
arguments | ... Constructor arguments |
Returns | |
---|---|
node | New node object |
number | x X coordinate |
number | y Y coordinatex |
Returns | |
---|---|
camera | New camera object |
number | x X coordinate |
number | y Y coordinate |
Returns | |
---|---|
layer | New layer object |
number | x X coordinate |
number | y Y coordinate |
Returns | |
---|---|
sprite | New sprite object |
number | x (optional) X-position in pixels |
number | y (optional) Y-position in pixels |
number | width (optional) Width in pixels |
number | height (optional) Height in pixels |
Returns | |
---|---|
view | New view object |
node.construct(x, y) | This is an internal function |
node:compareDepth(other) | This is an internal function. Compares the depth of two nodes, based on their Y-coordinates. |
node:deconstruct() | This is an internal function |
node:destroy() | Destroys the node removing it from its parent layer. |
node:getDepth() | Gets the depth index relative to other nodes in the parent layer. |
node:getParent() | Gets the current parent layer of the node. |
node:getPosition() | Gets the position of the node. |
node:getRoot() | Returns the root layer of the node or nil if the current node does not have a parent. |
node:getRotation() | Gets the rotation of the node. |
node:getScale() | Gets the scale of the node. |
node:getTransform() | Gets the position and rotation of the node. |
node:getVisible() | Gets the visibility of the node. Non-visible nodes are not drawn at all. |
node:localToParent(x, y) | Converts a position from local to parent coordinates. The center of the parent layer is its origin. |
node:localToRoot(x, y) | Converts a position from local to scene coordinates. The origin of the scene is the center of the root layer. |
node:localToWindow(x, y) | Converts a position from local to window coordinates. This function works only if the root node is a view object or returns nil otherwise. |
node:parentToLocal(x, y) | Converts a position from parent to local coordinates. The center of the parent layer is its origin. |
node:reset(x, y) | This is an internal function |
node:rootToLocal(x, y) | Converts a position from scene to local coordinates. The origin of the scene is the center of the root layer. |
node:setDepth(index) | Sets the depth index relative to other nodes in the parent layer. Setting the depth to 1 will draw the node first, before all others. Setting the depth to 0 will draw the node last, after all others. This depth index may shift as nodes are added, removed or sorted. |
node:setParent(parent) | Sets the parent layer of the node. All nodes can have just one parent. |
node:setPosition(x, y) | Sets the position of the node. |
node:setRotation(angle) | Sets the rotation of the node. |
node:setScale(sx, sy) | Sets the scale of the node. |
node:setTransform(x, y, angle) | Sets the position and rotation of the node. |
node:setVisible(True) | Sets the visibility of the node. Non-visible nodes are not drawn at all. |
node:type() | Returns the node type as a string |
node:windowToLocal(x, y) | Converts a position from window to local coordinates. This function works only if the root node is a view object or returns nil otherwise. |
number | x X-coordinate |
number | y Y-coordinate |
Returns | |
---|---|
node | New node |
node | other Other other |
Returns | |
---|---|
boolean | True if this node is in front of the other |
Returns | |
---|---|
number | Depth index |
Returns | |
---|---|
layer | Current parent layer |
Returns | |
---|---|
number | X-coordinate |
number | Y-coordinate |
Returns | |
---|---|
layer | Root layer |
Returns | |
---|---|
number | Angle in radians |
Returns | |
---|---|
number | X-axis scale |
number | Y-axis scale |
Returns | |
---|---|
number | X-coordinate |
number | Y-coordinate |
number | Angle in radians |
Returns | |
---|---|
boolean | True if visible |
number | x Local X-coordinate |
number | y Local Y-coordinate |
Returns | |
---|---|
number | Parent X-coordinate |
number | Parent Y-coordinate |
number | x Local X-coordinate |
number | y Local Y-coordinate |
Returns | |
---|---|
number | Scene X-coordinate |
number | Scene Y-coordinate |
number | x Local X-coordinate |
number | y Local Y-coordinate |
Returns | |
---|---|
number | Window X-coordinate |
number | Window Y-coordinate |
number | x Parent X-coordinate |
number | y Parent Y-coordinate |
Returns | |
---|---|
number | Local X-coordinate |
number | Local Y-coordinate |
number | x X-coordinate |
number | y Y-coordinate |
number | x Scene X-coordinate |
number | y Scene Y-coordinate |
Returns | |
---|---|
number | Local X-coordinate |
number | Local Y-coordinate |
number | index Depth index (could be negative) |
layer | parent New parent layer |
number | x X-coordinate |
number | y Y-coordinate |
number | angle Angle in radians |
number | sx X-axis scale |
number | sy Y-axis scale |
number | x X-coordinate |
number | y Y-coordinate |
number | angle Angle in radians |
boolean | True if visible |
Returns | |
---|---|
string | Node type ("Sprite", "Layer" or "View"). |
number | x Window X-coordinate |
number | y Window Y-coordinate |
Returns | |
---|---|
number | Local X-coordinate |
number | Local Y-coordinate |
node | |
---|---|
node:compareDepth(other) | This is an internal function. Compares the depth of two nodes, based on their Y-coordinates. |
node:destroy() | Destroys the node removing it from its parent layer. |
node:getDepth() | Gets the depth index relative to other nodes in the parent layer. |
node:getParent() | Gets the current parent layer of the node. |
node:getPosition() | Gets the position of the node. |
node:getRoot() | Returns the root layer of the node or nil if the current node does not have a parent. |
node:getRotation() | Gets the rotation of the node. |
node:getScale() | Gets the scale of the node. |
node:getTransform() | Gets the position and rotation of the node. |
node:getVisible() | Gets the visibility of the node. Non-visible nodes are not drawn at all. |
node:localToParent(x, y) | Converts a position from local to parent coordinates. The center of the parent layer is its origin. |
node:localToRoot(x, y) | Converts a position from local to scene coordinates. The origin of the scene is the center of the root layer. |
node:localToWindow(x, y) | Converts a position from local to window coordinates. This function works only if the root node is a view object or returns nil otherwise. |
node:parentToLocal(x, y) | Converts a position from parent to local coordinates. The center of the parent layer is its origin. |
node:rootToLocal(x, y) | Converts a position from scene to local coordinates. The origin of the scene is the center of the root layer. |
node:setDepth(index) | Sets the depth index relative to other nodes in the parent layer. Setting the depth to 1 will draw the node first, before all others. Setting the depth to 0 will draw the node last, after all others. This depth index may shift as nodes are added, removed or sorted. |
node:setParent(parent) | Sets the parent layer of the node. All nodes can have just one parent. |
node:setPosition(x, y) | Sets the position of the node. |
node:setRotation(angle) | Sets the rotation of the node. |
node:setScale(sx, sy) | Sets the scale of the node. |
node:setTransform(x, y, angle) | Sets the position and rotation of the node. |
node:setVisible(True) | Sets the visibility of the node. Non-visible nodes are not drawn at all. |
node:type() | Returns the node type as a string |
node:windowToLocal(x, y) | Converts a position from window to local coordinates. This function works only if the root node is a view object or returns nil otherwise. |
sprite | |
sprite.construct(x, y) | This is an internal function Please use scene.newSprite or layer.newSprite instead. |
sprite:deconstruct() | This is an internal function |
sprite:draw() | This is an internal function |
sprite:getAlpha() | Gets the alpha value. |
sprite:getColor() | Gets the color. |
sprite:getGraphic() | Gets the "drawable" graphic and quad of the sprite. |
sprite:getMode() | Gets the blending mode. |
sprite:getShader() | Gets the shader used when drawing the sprite. |
sprite:reset(x, y) | Resets the node to its initial state. |
sprite:setAlpha(alpha) | Sets the alpha value. |
sprite:setColor(red, green, blue) | Sets the color. |
sprite:setGraphic(drawable, quad, x, y, angle, sx, sy, ox, oy, kx, ky) | Sets a "drawable" graphic or a quad for the sprite. This could be an image, text, mesh, canvas, etc. The "drawable" graphic can be transformed relative to the sprite's origin. |
sprite:setMode(mode) | Sets the blending mode. |
sprite:setShader(shader) | Sets the shader used when drawing the sprite. |
number | x X coordinate |
number | y Y coordinate |
Returns | |
---|---|
sprite | New sprite |
Returns | |
---|---|
number | Alpha value (0-1) |
Returns | |
---|---|
number | Red value (0-1) |
number | Green value (0-1) |
number | Blue value (0-1) |
Returns | |
---|---|
userdata | Drawable graphic |
userdata | Quad or nil |
Returns | |
---|---|
string | mode Blend mode |
Returns | |
---|---|
userdata | Shader object |
number | x X-coordinate |
number | y Y-coordinate |
number | alpha Alpha value (0-1) |
number | red Red value (0-1) |
number | green Green value (0-1) |
number | blue Blue value (0-1) |
userdata | drawable Drawable graphic |
userdata | quad (optional) Optional quad |
number | x (0) X coordinate |
number | y (0) y coordinate |
number | angle (0) Angle |
number | sx (1) X axis scale |
number | sy (1) Y axis scale |
number | ox (0) X axis offset |
number | oy (0) Y axis offset |
number | kx (0) X axis shearing |
number | ky (0) Y axis shearing |
string | mode Blend mode: "alpha", "add", "subtract" or "multiply" |
userdata | shader Shader object |
node | |
---|---|
node:compareDepth(other) | This is an internal function. Compares the depth of two nodes, based on their Y-coordinates. |
node:destroy() | Destroys the node removing it from its parent layer. |
node:getDepth() | Gets the depth index relative to other nodes in the parent layer. |
node:getParent() | Gets the current parent layer of the node. |
node:getPosition() | Gets the position of the node. |
node:getRoot() | Returns the root layer of the node or nil if the current node does not have a parent. |
node:getRotation() | Gets the rotation of the node. |
node:getScale() | Gets the scale of the node. |
node:getTransform() | Gets the position and rotation of the node. |
node:getVisible() | Gets the visibility of the node. Non-visible nodes are not drawn at all. |
node:localToParent(x, y) | Converts a position from local to parent coordinates. The center of the parent layer is its origin. |
node:localToRoot(x, y) | Converts a position from local to scene coordinates. The origin of the scene is the center of the root layer. |
node:localToWindow(x, y) | Converts a position from local to window coordinates. This function works only if the root node is a view object or returns nil otherwise. |
node:parentToLocal(x, y) | Converts a position from parent to local coordinates. The center of the parent layer is its origin. |
node:rootToLocal(x, y) | Converts a position from scene to local coordinates. The origin of the scene is the center of the root layer. |
node:setDepth(index) | Sets the depth index relative to other nodes in the parent layer. Setting the depth to 1 will draw the node first, before all others. Setting the depth to 0 will draw the node last, after all others. This depth index may shift as nodes are added, removed or sorted. |
node:setParent(parent) | Sets the parent layer of the node. All nodes can have just one parent. |
node:setPosition(x, y) | Sets the position of the node. |
node:setRotation(angle) | Sets the rotation of the node. |
node:setScale(sx, sy) | Sets the scale of the node. |
node:setTransform(x, y, angle) | Sets the position and rotation of the node. |
node:setVisible(True) | Sets the visibility of the node. Non-visible nodes are not drawn at all. |
node:type() | Returns the node type as a string |
node:windowToLocal(x, y) | Converts a position from window to local coordinates. This function works only if the root node is a view object or returns nil otherwise. |
layer | |
layer.construct(x, y) | This is an internal function Please use scene.newLayer or layer.newLayer instead. |
layer:deconstruct() | This is an internal function |
layer:destroyChildren() | Destroys all of the child nodes. |
layer:draw() | This is an internal function |
layer:getChild(index) | Returns a child node based on depth index (could be negative). |
layer:getChildDepth(child) | Gets the depth index of a child node. |
layer:insertChild(child) | This is an internal function Adds a new child node to the layer. |
layer:newCamera(x, y) | Creates a new camera at the given position. Sets the parent of the new camera to the current node. |
layer:newLayer(x, y) | Creates a new layer at the given position. Sets the parent of the new layer to the current node. |
layer:newSprite(x, y) | Creates a new sprite at the given position. Sets the parent of the new sprite to the current node. |
layer:removeChild(child) | This is an internal function Removes an existing child node from the layer. |
layer:removeChildren() | Removes all child nodes without destroying them. |
layer:reset(x, y) | This is an internal function |
layer:setChildDepth(child, index) | Sets the depth index of a child node. This depth index may shift as node are added, removed or sorted. |
layer:sort(func) | Sorts the child nodes based on a comparison function. If no comparison function is specified, nodes are sorted based on their Y-coordinates. This is useful in isometric or overhead games. |
number | x X coordinate |
number | y Y coordinate |
Returns | |
---|---|
layer | New layer |
number | index Depth index |
node | child Child node |
Returns | |
---|---|
number | Depth index |
node | child Child node |
number | x X-coordinate |
number | y Y-coordinate |
Returns | |
---|---|
camera | New camera object |
number | x X-coordinate |
number | y Y-coordinate |
Returns | |
---|---|
layer | New layer object |
number | x X-coordinate |
number | y Y-coordinate |
Returns | |
---|---|
sprite | New sprite object |
node | child Child node |
number | x X-coordinate |
number | y Y-coordinate |
node | child Child node |
number | index Depth index (could be negative) |
function | func (optional) Comparison function |
node | |
---|---|
node:compareDepth(other) | This is an internal function. Compares the depth of two nodes, based on their Y-coordinates. |
node:deconstruct() | This is an internal function |
node:destroy() | Destroys the node removing it from its parent layer. |
node:getDepth() | Gets the depth index relative to other nodes in the parent layer. |
node:getParent() | Gets the current parent layer of the node. |
node:getPosition() | Gets the position of the node. |
node:getRoot() | Returns the root layer of the node or nil if the current node does not have a parent. |
node:getRotation() | Gets the rotation of the node. |
node:getScale() | Gets the scale of the node. |
node:getTransform() | Gets the position and rotation of the node. |
node:getVisible() | Gets the visibility of the node. Non-visible nodes are not drawn at all. |
node:localToParent(x, y) | Converts a position from local to parent coordinates. The center of the parent layer is its origin. |
node:localToRoot(x, y) | Converts a position from local to scene coordinates. The origin of the scene is the center of the root layer. |
node:localToWindow(x, y) | Converts a position from local to window coordinates. This function works only if the root node is a view object or returns nil otherwise. |
node:parentToLocal(x, y) | Converts a position from parent to local coordinates. The center of the parent layer is its origin. |
node:rootToLocal(x, y) | Converts a position from scene to local coordinates. The origin of the scene is the center of the root layer. |
node:setDepth(index) | Sets the depth index relative to other nodes in the parent layer. Setting the depth to 1 will draw the node first, before all others. Setting the depth to 0 will draw the node last, after all others. This depth index may shift as nodes are added, removed or sorted. |
node:setParent(parent) | Sets the parent layer of the node. All nodes can have just one parent. |
node:setPosition(x, y) | Sets the position of the node. |
node:setRotation(angle) | Sets the rotation of the node. |
node:setScale(sx, sy) | Sets the scale of the node. |
node:setTransform(x, y, angle) | Sets the position and rotation of the node. |
node:setVisible(True) | Sets the visibility of the node. Non-visible nodes are not drawn at all. |
node:type() | Returns the node type as a string |
node:windowToLocal(x, y) | Converts a position from window to local coordinates. This function works only if the root node is a view object or returns nil otherwise. |
camera | |
camera.construct(x, y) | This is an internal function Please use scene.newCamera or layer.newCamera instead. |
camera:draw() | This is an internal function |
camera:getRange() | Gets the viewing range of the camera in scene units. Returns zero if no range is specified. |
camera:render(view) | This is an internal function |
camera:reset(x, y) | This is an internal function |
camera:setRange(width, height) | Sets the viewing range of the camera in scene units. The camera node's scale is ignored upon setting a non-zero range. When the viewing range is set to zero, the rendered area is determined by the camera's scale and the dimensions of the view object. |
number | x X coordinate |
number | y Y coordinate |
Returns | |
---|---|
camera | New camera |
Returns | |
---|---|
number | Range width in scene units |
number | Range height in scene units |
node | view View object |
number | x X-coordinate |
number | y Y-coordinate |
number | width Range width in scene units |
number | height Range height in scene units |
node | |
---|---|
node:compareDepth(other) | This is an internal function. Compares the depth of two nodes, based on their Y-coordinates. |
node:destroy() | Destroys the node removing it from its parent layer. |
node:getDepth() | Gets the depth index relative to other nodes in the parent layer. |
node:getParent() | Gets the current parent layer of the node. |
node:getRoot() | Returns the root layer of the node or nil if the current node does not have a parent. |
node:getRotation() | Gets the rotation of the node. |
node:getScale() | Gets the scale of the node. |
node:getTransform() | Gets the position and rotation of the node. |
node:getVisible() | Gets the visibility of the node. Non-visible nodes are not drawn at all. |
node:localToParent(x, y) | Converts a position from local to parent coordinates. The center of the parent layer is its origin. |
node:parentToLocal(x, y) | Converts a position from parent to local coordinates. The center of the parent layer is its origin. |
node:setDepth(index) | Sets the depth index relative to other nodes in the parent layer. Setting the depth to 1 will draw the node first, before all others. Setting the depth to 0 will draw the node last, after all others. This depth index may shift as nodes are added, removed or sorted. |
node:setParent(parent) | Sets the parent layer of the node. All nodes can have just one parent. |
node:setRotation(angle) | Sets the rotation of the node. |
node:setScale(sx, sy) | Sets the scale of the node. |
node:setTransform(x, y, angle) | Sets the position and rotation of the node. |
node:setVisible(True) | Sets the visibility of the node. Non-visible nodes are not drawn at all. |
node:type() | Returns the node type as a string |
layer | |
layer:destroyChildren() | Destroys all of the child nodes. |
layer:getChild(index) | Returns a child node based on depth index (could be negative). |
layer:getChildDepth(child) | Gets the depth index of a child node. |
layer:insertChild(child) | This is an internal function Adds a new child node to the layer. |
layer:newCamera(x, y) | Creates a new camera at the given position. Sets the parent of the new camera to the current node. |
layer:newLayer(x, y) | Creates a new layer at the given position. Sets the parent of the new layer to the current node. |
layer:newSprite(x, y) | Creates a new sprite at the given position. Sets the parent of the new sprite to the current node. |
layer:removeChild(child) | This is an internal function Removes an existing child node from the layer. |
layer:removeChildren() | Removes all child nodes without destroying them. |
layer:setChildDepth(child, index) | Sets the depth index of a child node. This depth index may shift as node are added, removed or sorted. |
layer:sort(func) | Sorts the child nodes based on a comparison function. If no comparison function is specified, nodes are sorted based on their Y-coordinates. This is useful in isometric or overhead games. |
view | |
view.construct(x, y, width, height) | This is an internal function Please use scene.newView instead. |
view:deconstruct() | This is an internal function |
view:draw() | By default, this function draws the view and all of its visible child nodes. |
view:getBackground() | Gets the background color. |
view:getCamera() | Gets the camera associated with the view. |
view:getDimensions() | Gets the dimensions of the view inside the game window. |
view:getOrigin() | Gets the origin of the view object as ratio values, where 0, 0 is the top-left corner and 1, 1 is the bottom right. The origin of the view is the center or 0.5, 0.5. |
view:getPosition() | Gets the position of the view inside the application window. |
view:getShader() | Gets the pixel shader. |
view:localToRoot(x, y) | Converts a position from local to scene coordinates. The origin of the scene is the center of the root layer. |
view:localToWindow(x, y) | Converts a position from scene to window coordinates. The origin of the scene is the center of the root layer. |
view:reset(x, y, width, height) | This is an internal function |
view:rootToLocal(x, y) | Converts a position from scene to local coordinates. The origin of the scene is the center of the root layer. |
view:rootToWindow(x, y) | Converts scene coordinates to window coordinates. This function works in conjunction with the currently associated camera. |
view:setBackground(red, green, blue, alpha) | Sets the background color. |
view:setCamera(camera) | Sets the camera for the view. |
view:setDimensions(width, height) | Sets the dimensions of the view inside the game window. |
view:setOrigin(ox, oy) | Sets the origin of the view object based ratio values, where 0, 0 is the top-left corner and 1, 1 is the bottom right. The default origin of the view is the center or 0.5, 0.5. |
view:setPosition(x, y) | Sets the position of the view inside the application window. |
view:setShader(shader) | Sets the pixel shader. |
view:windowToLocal(x, y) | Converts a position from window to scene coordinates. The origin of the scene is the center of the root layer. |
view:windowToRoot(x, y) | Converts window coordinates to scene coordinates. This function works in conjunction with the currently associated camera. |
number | x (optional) X-position in pixels |
number | y (optional) Y-position in pixels |
number | width (optional) Width in pixels |
number | height (optional) Height in pixels |
Returns | |
---|---|
view | New view object |
Returns | |
---|---|
number | Red value (0-1) |
number | Green value (0-1) |
number | Blue value (0-1) |
number | Alpha value (0-1) |
Returns | |
---|---|
camera | camera Camera object |
Returns | |
---|---|
number | Width in pixels |
number | Height in pixels |
Returns | |
---|---|
number | X-ratio from 0 to 1 |
number | Y-ratio from 0 to 1 |
Returns | |
---|---|
number | X-position in pixels |
number | Y-position in pixels |
Returns | |
---|---|
userdata | Pixel shader object |
number | x Local X-coordinate |
number | y Local Y-coordinate |
Returns | |
---|---|
number | Scene X-coordinate |
number | Scene Y-coordinate |
number | x X scene coordinate |
number | y Y scene coordinate |
Returns | |
---|---|
number | X-position in pixels |
number | Y-position in pixels |
number | x X-position in pixels |
number | y Y-position in pixels |
number | width Width in pixels |
number | height Height in pixels |
number | x Scene X-coordinate |
number | y Scene Y-coordinate |
Returns | |
---|---|
number | Local X-coordinate |
number | Local Y-coordinate |
number | x X scene coordinate |
number | y Y scene coordinate |
Returns | |
---|---|
number | X-position in pixels |
number | Y-position in pixels |
number | red Red value (0-1) |
number | green Green value (0-1) |
number | blue Blue value (0-1) |
number | alpha (optional) Alpha value (0-1) |
camera | camera Camera object |
number | width Width in pixels |
number | height Height in pixels |
number | ox X-ratio from 0 to 1 |
number | oy Y-ratio from 0 to 1 |
number | x X-position in pixels |
number | y Y-position in pixels |
userdata | shader (optional) Pixel shader object |
number | x X-position in pixels |
number | y Y-position in pixels |
Returns | |
---|---|
number | X scene coordinate |
number | Y scene coordinate |
number | x X-position in pixels |
number | y Y-position in pixels |
Returns | |
---|---|
number | X scene coordinate |
number | Y scene coordinate |