HANGMAN
Code Explanation
} Closes the function
function drawneck() { Header for the function for drawing the neck
ctx.strokeStyle=bodycolor; Sets the color
ctx.beginPath(); Starts the path
ctx.moveTo(bodycenterx,90); Moves to the position
ctx.lineTo(bodycenterx,95); Draws the line
ctx.stroke(); Actually draws the path
ctx.closePath(); Closes the path
} Closes the function
function init(){ Header for the function called on document
load
ctx = document.getElementById
('canvas').getContext('2d');
Sets up the variable for all drawing on canvas
setupgame(); Invokes the function that sets up the game
ctx.font="bold 20pt Ariel"; Sets the font
} Closes the function
function setupgame() { Header for the function that sets up the
alphabet buttons and the secret word
var i; Creates the variable for iterations
var x; Creates the variable for position
var y; Creates the variable for position
var uniqueid; Creates the variable for each of each set of
created HTML elements
var an = alphabet.length; Will be 26