O'Reilly logo

Monkey Game Development by Michael Hartlef

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

Creating 2D arrays

In this game, we want to store the tile map information inside a two-dimensional array. If you don't know what a 2D array is, imagine a table. The first dimension is represented by the rows and the second dimension by the columns. A 1D array is comparable with a table with just one column and several rows.

Here are two illustrations that show the difference:

Creating 2D arrays

In the preceding image, you see an array with one dimension. It has just one column and the data is stored in a sequence, row after row. The following image shows an array with two dimensions. The difference here is that the second dimension is achieved by another column. You ...

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