The Essential Guide to HTML5

(Greg DeLong) #1

MAZES


Code Explanation


t=0.0; }^

else if (t>1.0) {^

t = 1.0;^

}^


dx = (sx+t*(fx-sx))-cx;^

dy = (sy +t*(fy-sy))-cy;^

rt = (dx*dx) +(dy*dy);^

if (rt<(rad*rad)) {^

return true; }^

else {^

return false;}^

}^


function getwalls() {^

var swalls;^

var sw;^

var i;^

var sx;^

var sy;^

var fx;^

var fy;^

var curwall;^
Free download pdf