Create a Bigger World with Tile Map Nodes

Apple Game Frameworks and Technologies — by Tammy Coron (96 / 193)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Chapter 10 Extending Your Game World with Tile Maps | TOC | Create a Tile Map Node 👉

Like other nodes in SpriteKit, the SKTileMapNode class is a subclass of the SKNode class, which means you can set the usual node properties like position and name. You can also run actions and use shaders[40] on these nodes. More important, though, you can define a tile set object using the SKTileSet class.

A tile set object stores an array of related tile groups. A tile group (SKTileGroup) can contain either a single tile (SKTileDefinition) or an array of tile group rules (SKTileGroupRule). A tile’s definition, along with the group rules, define how the tiles are placed within a tile map node.

Confused? I’m not surprised. The rabbit hole of tile maps and supporting classes can get pretty deep, especially when you travel down that hole using code. But there’s good news: you don’t have to build your maps using code. Instead, you can use a combination of the Scene Editor and the Tile Map Editor — but first, you need to add some assets.

Adding the Assets

To begin, open the valsrevenge project in Xcode.

Using the Starter Project

You may continue using your project from the previous chapter, or you can use the starter project located in the…

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.