TiledMappableGeometryType
@objc
public protocol TiledMappableGeometryType : TiledGeometryType
The TiledMappableGeometryType
protocol describes a container that is broken up into two-dimensional tiles.
Properties
orientation
: Container orientationisInfinite
: Container represents and infinite area.mapSize
: Container size (in tiles)graph
: Container pathfinding graph (optional)childOffset
: Child node offset (optional)tileSize
: Tile size (in pixels)hexsidelength
: Hexagonal side lengthstaggeraxis
: Hexagonal stagger axisstaggerindex
: Hexagonal stagger index
-
The map projection type.
Declaration
Swift
@objc var orientation: TilemapOrientation { get }
-
Indicates the container represents an infinite map.
Declaration
Swift
@objc var isInfinite: Bool { get }
-
Container size (in tiles).
Declaration
Swift
@objc var mapSize: CGSize { get }
-
Optional pathfinding
GKGridGraph
graph.Declaration
Swift
@objc optional weak var graph: GKGridGraph<GKGridGraphNode>? { get set }
-
Child node offset. Used by a map container to align child layers.
Declaration
Swift
@objc optional var childOffset: CGPoint { get }
-
Tile size (in pixels).
Declaration
Swift
@objc var tileSize: CGSize { get }
-
Hexagonal side length.
Declaration
Swift
@objc var hexsidelength: Int { get set }
-
Hexagonal stagger axis.
Declaration
Swift
@objc var staggeraxis: StaggerAxis { get set }
-
Hexagonal stagger index.
Declaration
Swift
@objc var staggerindex: StaggerIndex { get set }
-
width
Extension methodReturns the width (in tiles) of the container.
Declaration
Swift
public var width: CGFloat { get }
-
height
Extension methodReturns the height (in tiles) of the container.
Declaration
Swift
public var height: CGFloat { get }
-
sizeHalved
Extension methodReturns the size (in tiles) of the container halved.
Declaration
Swift
public var sizeHalved: CGSize { get }
-
tileWidth
Extension methodReturns the tile width (in pixels) value.
Declaration
Swift
public var tileWidth: CGFloat { get }
-
tileHeight
Extension methodReturns the tile height (in pixels) value.
Declaration
Swift
public var tileHeight: CGFloat { get }
-
tileSizeHalved
Extension methodReturns the tile size (in pixels) of the container halved.
Declaration
Swift
public var tileSizeHalved: CGSize { get }
-
tileWidthHalf
Extension methodReturns the tile size width (in pixels), halved.
Declaration
Swift
public var tileWidthHalf: CGFloat { get }
Return Value
tile size half-width.
-
tileHeightHalf
Extension methodReturns the tile size height (in pixels), halved.
Declaration
Swift
public var tileHeightHalf: CGFloat { get }
Return Value
tile size half-height.
-
sizeInPoints
Extension methodReturns the size of the container, in points.
Declaration
Swift
public var sizeInPoints: CGSize { get }
-
sizeInPixels
Extension methodThe size of the container, in pixels.
Declaration
Swift
public var sizeInPixels: CGSize { get }
-
origin
Extension methodReturns the position of layer origin point. Used only in
SKTileObject.getVertices(offset:)
.Declaration
Swift
public var origin: CGPoint { get }
-
staggerX
Extension methodIndicates the x-axis should be staggered.
Declaration
Swift
public var staggerX: Bool { get }
-
staggerEven
Extension methodIndicates even rows should be staggered.
Declaration
Swift
public var staggerEven: Bool { get }
-
sideLengthX
Extension methodReturns the side length for flat hexagons.
Declaration
Swift
public var sideLengthX: CGFloat { get }
-
sideLengthY
Extension methodReturns the side length for pointy hexagons.
Declaration
Swift
public var sideLengthY: CGFloat { get }
-
sideOffsetX
Extension methodReturns the side offset in x.
Declaration
Swift
public var sideOffsetX: CGFloat { get }
-
pointForCoordinate(coord:
Extension methodoffsetX: offsetY: ) Returns a screen point for a given coordinate in the object (layer or map), with optional offset values for x/y.
Declaration
Swift
public func pointForCoordinate(coord: simd_int2, offsetX: CGFloat = 0, offsetY: CGFloat = 0) -> CGPoint
Parameters
coord
tile coordinate.
offsetX
x-offset value.
offsetY
y-offset value.
Return Value
point in layer (spritekit space).
-
coordinateForPoint(point:
Extension method) Returns a tile coordinate for a given screen point in the object (layer or map).
Declaration
Swift
public func coordinateForPoint(point: CGPoint) -> simd_int2
Parameters
point
point in layer (spritekit space).
Return Value
tile coordinate.
-
shaderUniforms
Extension methodReturns an array of shader unforms based on the current attributes.
Declaration
Swift
public var shaderUniforms: [SKUniform] { get }
-
parents
Extension methodReturns an array of parent layers, beginning with the current.
Declaration
Swift
public var parents: [SKNode] { get }
-
addChild(_:
Extension methodcoord: offset: zpos: ) Add an
SKNode
child node at the given coordinates. By default, the zPositon will be higher than all of the other nodes in the layer.Declaration
Swift
public func addChild(_ node: SKNode, coord: simd_int2, offset: CGPoint = CGPoint.zero, zpos: CGFloat? = nil)
Parameters
node
SpriteKit node.
coord
map coordinate.
offset
offset amount.
zpos
optional z-position.
-
addChild(_:
Extension methodx: y: offset: zpos: ) Add an
SKNode
child node at the given x/y coordinates. By default, the zPositon will be higher than all of the other nodes in the layer.Declaration
Swift
public func addChild(_ node: SKNode, x: Int = 0, y: Int = 0, offset: CGPoint = CGPoint.zero, zpos: CGFloat? = nil)
Parameters
node
object.
x
map x-coordinate.
y
map y-coordinate.
offset
offset amount.
zpos
optional z-position.
-
addChild(_:
Extension method_: _: dx: dy: zpos: ) Add a node at the given coordinates. By default, the zPositon will be higher than all of the other nodes in the layer.
Declaration
Swift
public func addChild(_ node: SKNode, _ x: Int, _ y: Int, dx: CGFloat = 0, dy: CGFloat = 0, zpos: CGFloat? = nil)
Parameters
node
SpriteKit node.
x
map x-coordinate.
y
map y-coordinate.
dx
offset x-amount.
dy
offset y-amount.
zpos
z-position (optional).