Tile maps

The technique of tile maps became a successful approach to storing large amounts of information about game worlds with small, reusable pieces of graphics. In 2D games, tile maps are represented by a two-dimensional matrix that references to a tile object. This object contains the required data about each cell of the terrain.

The initial sheet used by the tile map contains the "building blocks" of our scenario, and it looks like what is shown in the following screenshot:

Tile maps

Starting from this simple image, we can build a grid map in which each cell is one of the squares the sheet is divided into.

Tiled Map Editor

We will use Tiled Map Editor

Get Python Game Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.