I recommend seting up your tile/map info into files. What i do (i'm also making a 2d top down zelda clone......different though) is have a file called Terrain.dat This file holds all the info of the Tiles in the game set out like this:
Tile Name
Tile Filename
Tile Access Number
Then, when use my map editor to make the map, it uses 2 arrays. First it loads all the Tile Numbers into an Array called MAP(), and saves it to a File called [Map Name].MAP, This is where i draw my map. Then i load all the Access Numbers into an Array called Access() and save it to a file called ACCESS.Acc
Open To Read 1 , [MAP NAME].MAP
For x = 0 to (Map Grid X Squares - 1)
For y = 0 to (Map Grid Y Squares - 1)
Read String 1,Tile$
Tile = val(Tile$)
Map(x,y) = Tile
Next y
Next X
Close File 1
Open To Read 2 , ACCESS.ACC
For x = 0 to (Map Grid X Squares - 1)
For y = 0 to (Map Grid Y Squares - 1)
Read String 2,Acc$
Acc = val(Acc$)
Access(x,y) = Acc
Next y
Next X
Then when you want to check for collisions/events, you look into the Access Array and read the Access Number. In my game, this is what they all mean.
0 = Cant ever walk on this tile (Wall etc....)
1 = Can Always walk on the tile
200 -> 299 = Doors that open a new map (Shop doors, edge of map)
300 -> 399 = Entrances, So the program knows what grid square to draw the player on when he walks through the door
400 -> 499 = Messages, when walked on displays a text file to screen
500 -> 599 = Merchants, when walked on opens up the shop menu
600 -> 699 = Monsters, when walked on starts combat
etc, etc......
That way all you do is change the Access number in your Terrain.dat file and when you make a map it has alot of flexibility. This is real simple Array Collision but i found it is soo powerful/useful.
Email me at:
[email protected]
If you need any help with your Zelda clone engine since i'm almost finished mine so i might be of some help to you.