SKGroupLayer
public class SKGroupLayer : TiledLayerObject
Subclass of TiledLayerObject
, the SKGroupLayer
node is a container for managing groups of layers.
Usage
Query child layers:
for child in group.layers {
child.opacity = 0.5
}
Add layers to the group with:
groupLayer.addLayer(playerLayer)
Remove with:
groupLayer.removeLayer(playerLayer)
-
Returns the last index for all layers.
Declaration
Swift
public var lastIndex: UInt32 { get }
-
Returns the last (highest) z-position in the map.
Declaration
Swift
public var lastZPosition: CGFloat { get }
-
Returns a flattened array of contained child layers.
Declaration
Swift
public override var layers: [TiledLayerObject] { get }
-
Speed modifier applied to all actions executed by the layer and its descendants.
Declaration
Swift
public override var speed: CGFloat { get set }
-
Overview
Set the layer tint color. Tiles contained in this layer will be tinted with the given color.
Declaration
Swift
public override var tintColor: SKColor? { get set }
-
Instantiate the node with a decoder instance.
Declaration
Swift
required public init?(coder aDecoder: NSCoder)
Parameters
aDecoder
decoder.
-
Returns all layers, sorted by index (first is lowest, last is highest).
Declaration
Swift
public func allLayers() -> [TiledLayerObject]
Return Value
array of layers.
-
Returns an array of layer names.
Declaration
Swift
public func layerNames() -> [String]
Return Value
layer names.
-
Add a layer to the layers set. Automatically sets zPosition based on the tilemap zDeltaForLayers attributes.
Declaration
Swift
@discardableResult public func addLayer(_ layer: TiledLayerObject, clamped: Bool = true) -> (success: Bool, layer: TiledLayerObject)
Parameters
layer
layer object.
clamped
clamp position to nearest pixel.
Return Value
add was successful, layer added.
-
Remove a layer from the current layers set.
Declaration
Swift
public func removeLayer(_ layer: TiledLayerObject) -> TiledLayerObject?
Parameters
layer
layer object.
Return Value
removed layer.
-
Update the group layer before each frame is rendered.
Declaration
Swift
public override func update(_ currentTime: TimeInterval)
Parameters
currentTime
update interval.
-
Returns the internal Tiled node type.
Declaration
Swift
@objc public var tiledElementName: String { get }
-
Returns a “nicer” node name, for usage in the inspector.
Declaration
Swift
@objc public override var tiledNodeNiceName: String { get }
-
Returns the internal Tiled node type icon.
Declaration
Swift
@objc public override var tiledIconName: String { get }
-
A description of the node used in list or outline views.
Declaration
Swift
@objc public override var tiledListDescription: String { get }
-
A description of the node used for debug output text.
Declaration
Swift
@objc public override var tiledDisplayItemDescription: String { get }
-
A description of the node type used for help features.
Declaration
Swift
@objc public override var tiledHelpDescription: String { get }