CHAPTER 7
Code Explanation
} Close if true clause
} Close for loop
} Close function
function Wall(sx,sy,fx,fy,width,stylestring) { Function header to make Wall
this.sx = sx; Set up sx property
this.sy = sy; ... sy
this.fx = fx; ... fx
this.fy = fy; ... fy
this.width = width; ... width
this.draw = drawAline; Set draw method
this.strokestyle = stylestring; ... strokestyle
} Close function
function drawAline() { Function header drawAline
ctx.lineWidth = this.width; Set the line width
ctx.strokeStyle = this.strokestyle; Set the strokestyle
ctx.beginPath(); Begin path
ctx.moveTo(this.sx,this.sy); Move to start of line
ctx.lineTo(this.fx,this.fy); Set line to finish
ctx.stroke(); Draw the line
} Close function
var mypent = new
Token(100,100,20,"rgb(0,0,250)",5);
Set up mypent as a pentagonal shape to
be the playing piece
everything.push(mypent); Add to everything