<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKTileMapNode",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKTileMapNode"
  },
  "title" : "SKTileMapNode"
}
-->

# SKTileMapNode

A two-dimensional array of images.

```
class SKTileMapNode
```

## Overview

`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`](/documentation/SpriteKit/SKShader) to add effects such as motion blur or atmospheric perspective.

> Note:
> A tile map can only render tile definitions that exist within the ``doc://com.apple.spritekit/documentation/SpriteKit/SKTileSet`` you have provided it.

> Important:
> A tile map does not expose its tiles as nodes, and therefore you cannot assign individual tiles with a different ``doc://com.apple.spritekit/documentation/SpriteKit/SKNode/zPosition`` or ``doc://com.apple.spritekit/documentation/SpriteKit/SKNode/physicsBody``. Instead, layer tile map nodes on top of each other at the varying zPositions, and layer invisible `SKNodes` on top of the tile map node to attach physicsBodies to your tile map node.

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:)`](/documentation/SpriteKit/SKTileMapNode/fill(with:)) method and set individual tiles with [`setTileGroup(_:andTileDefinition:forColumn:row:)`](/documentation/SpriteKit/SKTileMapNode/setTileGroup(_:andTileDefinition:forColumn:row:)).

## Topics

### Creating a Tile Map Programmatically

Create a tile map manually instead of loading it from an archived `.sks` file.

[Creating a Tile Map Programmatically](/documentation/SpriteKit/creating-a-tile-map-programmatically)

### Controlling a Tile Map’s On-Screen Position Relative to its Origin

[`anchorPoint`](/documentation/SpriteKit/SKTileMapNode/anchorPoint)

Defines the point in the tile map that corresponds to its [`position`](/documentation/SpriteKit/SKNode/position).

### Reading or Manually Configuring the Tile Map’s Size

[`tileSize`](/documentation/SpriteKit/SKTileMapNode/tileSize)

The size of each tile in points.

[`tileSet`](/documentation/SpriteKit/SKTileMapNode/tileSet)

The tile set being used by this tile map. The tile map object can only display tiles that exist in this set.

[`numberOfColumns`](/documentation/SpriteKit/SKTileMapNode/numberOfColumns)

The number of columns in the tile map

[`numberOfRows`](/documentation/SpriteKit/SKTileMapNode/numberOfRows)

The number of rows in the tile map.

### Querying the Tile Map’s Properties

[`centerOfTile(atColumn:row:)`](/documentation/SpriteKit/SKTileMapNode/centerOfTile(atColumn:row:))

[`tileColumnIndex(fromPosition:)`](/documentation/SpriteKit/SKTileMapNode/tileColumnIndex(fromPosition:))

[`tileDefinition(atColumn:row:)`](/documentation/SpriteKit/SKTileMapNode/tileDefinition(atColumn:row:))

[`tileGroup(atColumn:row:)`](/documentation/SpriteKit/SKTileMapNode/tileGroup(atColumn:row:))

[`tileRowIndex(fromPosition:)`](/documentation/SpriteKit/SKTileMapNode/tileRowIndex(fromPosition:))

Returns the tile map node object’s tile row index for the specified position in points.

[`mapSize`](/documentation/SpriteKit/SKTileMapNode/mapSize)

The overall size of the tile map.

### Tinting a Tile Map

[`color`](/documentation/SpriteKit/SKTileMapNode/color)

The base color for the tile map. The influence of the color over the tile map node’s textures is controlled by [`colorBlendFactor`](/documentation/SpriteKit/SKTileMapNode/colorBlendFactor).

[`colorBlendFactor`](/documentation/SpriteKit/SKTileMapNode/colorBlendFactor)

Controls the blending between the texture and the tile map object’s [`color`](/documentation/SpriteKit/SKTileMapNode/color). Values are clamped between zero and one where zero has no color blending and one has the maximum color blending.

### Lighting a Tile Map

Configure how a sprite is lit when its near a light node.

[`lightingBitMask`](/documentation/SpriteKit/SKTileMapNode/lightingBitMask)

A mask that defines how the tile map is lit by light nodes in the scene.

### Configuring How Alpha Values Blend the Sprite

Change how a sprite uses its alpha value, such as additive blending, that results in the sprite being brighter than it was before.

[`blendMode`](/documentation/SpriteKit/SKTileMapNode/blendMode)

Defines the blend mode to use when compositing the tile map over other nodes.

### Working with Custom Shaders

[`shader`](/documentation/SpriteKit/SKTileMapNode/shader)

Defines a shader which is applied to each tile of the tile map.

[`attributeValues`](/documentation/SpriteKit/SKTileMapNode/attributeValues)

The values of each attribute associated with the node’s attached shader.

[`setValue(_:forAttribute:)`](/documentation/SpriteKit/SKTileMapNode/setValue(_:forAttribute:))

Sets an attribute value for an attached shader.

[`value(forAttributeNamed:)`](/documentation/SpriteKit/SKTileMapNode/value(forAttributeNamed:))

The value of a shader attribute.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)