HTML and CSS Reference
In-Depth Information
Code
Explanation
sw = wallstgs[i].split("+");
Split individual item
sx = Number(sw[0]);
Extract 0
th
value and convert to number
sy = Number(sw[1]);
…1
st
fx = Number(sw[2]);
…2
nd
fy = Number(sw[3]);
...3
rd
curwall = new
Wall(sx,sy,fx,fy,wallwidth,wallstyle);
Create new
Wall
using extracted and
fixed values
walls.push(curwall);
Add to
walls
array
everything.push(curwall);
Add to
everything
array
}
Close loop
drawall();
Draw everything
}
Close if not null
Else {
Was null
alert("No data retrieved.");
No data
}
Close clause
window.addEventListener('keydown',
getkeyAndMove,false);
Set up
keydown
action
return false;
Return false to prevent refresh
}
Close function
</head>
End
head
element
<body onLoad="init();" >
Start
body
, set up call to
init
<canvas id="canvas" width="900" height="350">
Canvas tag
Your browser doesn't support the HTML5 element
canvas.
Warning for certain browser.