I have a school assignment where I have to draw a 2D map from one of the first zelda games, along with some animated sprites. Now I got the sprites to work, Im having trouble drawing the map. This is what it should look like:
This is the TileSet that we have to use to draw the map (each tile is 32x32 pixels):
We work in a custom game engine that our teacher made for us.
To draw a bitmap we use this command: GAME_ENGINE.DrawBitmap([Name], x.cord (on the canvas), y.cord (on the canvas), x.cord(on the Tileset), y.cord(on the Tileset), amount of pixels you want to cut out of the Tileset (Width), amount of pixels you want to cut out of the Tileset (Height).
If I use this command I would draw the staircase tile (top left) on the canvas: GAME_ENGINE.DrawBitmap([Name], 200, 200, 0, 0, 32, 32);
So I found out that with a nested for loop you can draw a 2D map on the canvas, this is the code I used for that:
for (int y = 0; y < 10; y++)
{
for (int x = 0; x < 16; x++)
{
GAME_ENGINE.DrawBitmap(Link_Level, 128 + (x * 32), 0 + (y * 32), 0, 0, 32, 32);
}
}
But obviously then it draws a 16 x 10 map consisting of only one tile.
My question is: How can I use that same for loop but somehow let it know which tiles to draw on the correct position?
Any help would be appreciated!