CHAPTER 7
Code Explanation
var lsname;^
for
(i=0;i<document.gf.level.length;i++) {
Iterate through the radio buttons in the gf
form, level group
if (document.gf.level[i].checked) { Is this radio button checked?
lsname=
document.gf.level[i].value+"maze";
If so, construct the local storage name using
the value attribute of the radio button element
break; Leave the for loop
} Close if
} Close for
swalls=localStorage.getItem(lsname); Fetch this item from local storage
if (swalls!=null) { If it is not null, it is good data
wallstgs = swalls.split(";"); Extract the string for each wall
walls = []; Removes any old walls from walls array
everything = []; Removes any old walls from everything
array
everything.push(mypent); Do add the pentagon-shaped token called
mypent to everything
for (i=0;i<wallstgs.length;i++) { Proceed to decode each wall. The remaining
code is the same as the all-in-one application.
sw = wallstgs[i].split("+");
sx = Number(sw[0]);^
sy = Number(sw[1]);^
fx = Number(sw[2]);^
fy = Number(sw[3]);^