Node

public class Node: NodeGeometry, Tree, Equatable, Hashable

A Node is the most basic object from which most game type objects should be subclassed from.

This type cannot be rendered but contains all the necessary geometry to be used as if it were being displayed. It also contains the relevant information for adding and removing nodes to the tree hierarchy, running actions, and updating.

The following classes are subclasses of this and in general should be sufficient for most purposes. - Scene - ShapeNode - SpriteNode - TextNode - Camera

  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • x

    Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • y

    Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Designated initializer.

    Note

    The default size of a Node is .zero since a node does not necessarily get rendered. It can still, however, be part of a Scene and moved around as such.

    Declaration

    Swift

    public init(size: CGSize = .zero)

    Parameters

    size

    The size in the scene.

    Return Value

    A new instance of Node.

  • A function that’s called on every frame update. When subclassing Node be sure to call super in this function.

    Declaration

    Swift

    public func update(delta: CFTimeInterval)

    Parameters

    delta

    The amount of time that’s passed since this function was last called.

  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • True if this Node or any of it’s parents’ Node is currently running an action.

    Declaration

    Swift

    public var hasAction: Bool
  • Run an Action on the Node object.

    Declaration

    Swift

    public func runAction(action: Action)

    Parameters

    action

    The action to perform on the node.

  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable
  • Add a Node to this Node’s tree hiearchy.

    Declaration

    Swift

    public func addNode(node: Node)

    Parameters

    node

    The node to add to the tree.

  • Remove a Node from this Node’s tree hiearchy.

    Declaration

    Swift

    public func removeNode<T: Node>(node: T?) -> T?

    Parameters

    node

    The node to remove.

    Return Value

    The Node removed if it existed.

  • Undocumented

    Declaration

    Swift

    public class Node: NodeGeometry, Tree, Equatable, Hashable