O'Reilly logo

Python Game Programming By Example by Joseph Howse, Alejandro Rodas de Paz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required