Tilemap Storage and Retrival
Posted: Thu May 27, 2010 1:00 pm
A day ago or so I asked for help on displaying tilemaps and character movements. Now, I've gotten all of that working the way it should - but it only works with arrays.
In order to build multiple maps, I need to set up an array storage system that can call and retrieve them. I've tried serialize and that failed to work entirely.
The maps also have attributes, which can be stored separately if need be. Ideally, I want to use my SQL database to set up and pull the maps, but which method would be best? This is a sample array:
In display format, they are tiled something like this:
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000 - Although the final result actually produces a square.
In order to build multiple maps, I need to set up an array storage system that can call and retrieve them. I've tried serialize and that failed to work entirely.
The maps also have attributes, which can be stored separately if need be. Ideally, I want to use my SQL database to set up and pull the maps, but which method would be best? This is a sample array:
Code: Select all
$map = array(5,0,0,0,11,0,0,0,0,5,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,3,3,3,1,1,1,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,5,0,0,0,0,1,0,0,5,0)In display format, they are tiled something like this:
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000 - Although the final result actually produces a square.