SKTileMapNode
A two-dimensional array of images.
Declaration
class SKTileMapNodeOverview
SKTileMapNode does the work of laying out predefined tiles in a grid of any size. Typically, you configure 9-slice images (tile groups) in Xcode’s SpriteKit scene editor and paint the look of your tile map ahead of time versus configuring the tile map in code.
As with sprite nodes, you can layer tile maps with different blend modes or control it with actions and physics, for example, for the purpose of parallax scrolling. The rendered tile map can be post processed with an SKShader to add effects such as motion blur or atmospheric perspective.
To work with a tile map programmatically, you supply SKTileMapNode with a tile set that defines the tile definitions it can render. Then, fill each tile in the tile map with the fill(with:) method and set individual tiles with setTileGroup(_:andTileDefinition:forColumn:row:).
Topics
Creating a Tile Map Programmatically
Controlling a Tile Map’s On-Screen Position Relative to its Origin
Reading or Manually Configuring the Tile Map’s Size
Querying the Tile Map’s Properties
centerOfTile(atColumn:row:)tileColumnIndex(fromPosition:)tileDefinition(atColumn:row:)tileGroup(atColumn:row:)tileRowIndex(fromPosition:)mapSize