HTML and CSS Reference
In-Depth Information
Code
Explanation
}
Close if true clause
}
Close for loop
}
Close function
Function header to make Wall
function Wall(sx,sy,fx,fy,width,stylestring) {
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
strokestyle
this.strokestyle = stylestring;
}
Close function
function drawAline() {
Function header drawAline
ctx.lineWidth = this.width;
Set the line width
Set the strokestyle
ctx.strokeStyle = this.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
Search WWH ::




Custom Search