SpriteNode

public class SpriteNode: Node, Renderable

A SpriteNode is a node that can be rendered with a Texture. The applied texture can also be blended with a color.

  • Undocumented

    Declaration

    Swift

    public class SpriteNode: Node, Renderable
  • Undocumented

    Declaration

    Swift

    public class SpriteNode: Node, Renderable
  • Undocumented

    Declaration

    Swift

    public class SpriteNode: Node, Renderable
  • Undocumented

    Declaration

    Swift

    public class SpriteNode: Node, Renderable
  • Undocumented

    Declaration

    Swift

    public class SpriteNode: Node, Renderable
  • Designated initializer. Creates a new sprite object using an existing Texture.

    • discussion: The size should probably be the same as the texture size.

    Declaration

    Swift

    public required init(texture: Texture, color: Color, size: CGSize)

    Parameters

    texture

    The texture to apply to the node.

    color

    The color to blend with the texture.

    size

    The size of node.

    Return Value

    A new instance of SpriteNode.

  • Convenience initializer.

    • discussion: This initializer sets the color property to white.

    Declaration

    Swift

    public convenience init(texture: Texture, size: CGSize)

    Parameters

    texture

    The texture to apply to the node.

    size

    The size of the node.

    Return Value

    A new instance of SpriteNode.

  • Convenience initializer.

    • discussion: This creates a node with the same size as the texture as well as defaulting the color to white.

    Declaration

    Swift

    public convenience init(texture: Texture)

    Parameters

    texture

    The texture to apply to the node.

    Return Value

    A new instance of SpriteNode.

  • Convenience initializer.

    • discussion: This should really only be used for prototyping as this is the slowest and most memory intensive version. It’s pretty much used the same as UIImage(named:). Unlike UIImage, however, it will force load an error image in the case that the given image name does not exist. Defaults size to image size and color to white.

    Declaration

    Swift

    public convenience init(named: String)

    Parameters

    named

    The name of the texture/image to be used.

    Return Value

    A new instance of SpriteNote.