- Published on
Coordinate Based Map Updates
- Authors
- Name
- Tails Azimuth
Background
What is a tile-map, and how do we use it?
The Gameboy display is 160x144 pixels. That is the visible display. The tile map on the other hand is 256×256 pixels. Each tile is 8x8, so the tile map holds 32x32 tiles. The LCD can only display 20 tiles horizontally, and 18 tiles vertically, at any given time.
The Gameboy also has the ability to scroll, by writing to a specific register. If you imagine a typical top-down game, like Pokemon, the player's character sprite remains in the center of the display at all times. If you were paying attention, that means that, since the display is 20 tiles across, the character sprite has to be composed of an even number of tiles in order to remain center-aligned. So the character sprite is 16x16 pixels. It is important to note that sprites are not part of the tile-map. They are separate, and can move separately. That information is tangential to the topic of this article, but it will become relevent later. We are mainly concerned with the tile-map and moving the map across the display.
Here’s a codepen, and some other blog post text.