Tile

public class Tile : Propertied, Equatable

A Tile represents a 2D image that should be rendered when referenced on by an Object or Layer. It contains a reference to the image, and the portion of that image that should be used to generate the image.

  • The URL of the image used

    Declaration

    Swift

    public let imageSource: URL
  • The user specified type of the tile (if specified)

    Declaration

    Swift

    public var type: String?
  • Any user defined properties associated with the tile

    Declaration

    Swift

    public var properties: Properties
  • The color used in the image that should be treated as transparent (if any). This should not impact the interpretation of any alpha values also used for a color (i.e. it is addative)

    Declaration

    Swift

    public let transparentColor: Color?
  • The rectangle within the image that should be used to as the final Tile image. This enables a single image source to contain multiple Tile images

    Declaration

    Swift

    public let bounds: PixelBounds
  • Any Frames of animation

    Declaration

    Swift

    public var frames: [Frame]?
  • An array of Objects that make up the collision area for the Tile

    Declaration

    Swift

    public var collisionBodies: [Object]?
  • A unique identifier for the tile (where unique means another Tile with the same bounds would have the same uuid

    Declaration

    Swift

    public var uuid: String { get }
  • Creates a new instance of a tile

    Declaration

    Swift

    public init(_ imageSource: URL, bounds: PixelBounds, transparentColor: Color? = nil)

    Parameters

    imageSource

    The URL of the image the tile is or is in

    bounds

    The portion of the speciied image that should be used for the tile. If the whole image should be used, it will be a point with an origin of Point.zero and a size the same as the source image

    transparentColor

    The color in the image that should be treated as transparent (defaults to nil as modern formats typically contain alpha)

  • Compares two tiles to determine if they are equivalent

    Declaration

    Swift

    public static func == (lhs: Tile, rhs: Tile) -> Bool

    Parameters

    lhs

    The first Tile

    rhs

    The second Tile

    Return Value

    true if they are the same false otherwise