Was just curious is there any other way to program a map in JavaScript
using a different method besides arrays, below is just a small way of how i am rendering my maps
however my map is now huge and it is very bothersome to find the area i wish too edit. I am also using the array elements for collision.
if anyone knows of a different method please share. or you can just flame me for my code.
[spoiler]not my real map…
var Map = [
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0]
];
var Grass= new image();
Grass.src = “Grass.png”;
var PosX = 0;
var PosY = 0;
for (var i = 0; i < Map.length; i++) {
for (var j = 0; j < Map[i].length; j++) {
if(Map[i][j] == 0) {
context.drawImage(Grass, PosX, PosY, 32, 32);
}
PosX += 32;
}
PosX = 0;
PosY += 32;
}
[/spoiler]