Arrays are really powerful when it comes to game design. Essentially, an array is a grid of data. We can fill up this grid with any kind of information that we want. In the past, arrays were used quite heavily as the technology was limited, and even today arrays are still used and are still very useful. Here is a visual representation of an array:
(data) |
(data) |
(data) |
(data) |
(data) |
(data) |
(data) |
(data) |
An array is a table of data. You have probably seen this in a spreadsheet program. We can store multiple items of data in arrays. This differs from variables because we can now add large amounts, of data.
We can use arrays for the following purposes:
To save multiple points of data
To store game object information
To use a tile map
To create save states that save large amounts of information
To create a data set that will help us save time during development