Build a function to loop through the properties in the JSON level object and change the properties of the play field spans to match the textures set in the object.
for (prop in p) {
if (!p.hasOwnProperty(prop)) {
//The current property is not a direct property of p
continue;
}
//Do your logic with the property here
}
Build a function to loop through the properties in the JSON level object and change the properties of the play field spans to match the textures set in the object.
http://stackoverflow.com/questions/684672/loop-through-javascript-object
for (prop in p) { if (!p.hasOwnProperty(prop)) { //The current property is not a direct property of p continue; } //Do your logic with the property here }