The Essential Guide to HTML5

(Greg DeLong) #1

CHAPTER 9


Code Explanation


var alphabet = "abcdefghijklmnopqrstuvwxyz"; Defines letters of the alphabet, used for
alphabet buttons


var alphabety = 300; Vertical position for all alphabet buttons


var alphabetx = 20; Starting alphabet horizontal position


var alphabetwidth = 25; Width allocated for the alphabet elements


var secret; Will hold the secret word


var lettersguessed = 0; Keeps count of letters guessed


var secretx = 160; Horizontal starting position for secret word


var secrety = 50; Vertical position for secret word


var secretwidth = 50; Width allocated for each letter in display of
secret word


var gallowscolor = "brown"; Color for the gallows


var facecolor = "tan"; Color for the face


var bodycolor = "tan"; Color for the body


var noosecolor = "#F60"; Color for the noose


var bodycenterx = 70; Horizontal position for the body


var steps = [ Holds the functions constituting the sequence
of drawings for the progression toward the
hanging


drawgallows, Draws the gallows


drawhead, Draws the head


drawbody, Draws the body


drawrightarm, Draws the right arm


drawleftarm, Draws the left arm

Free download pdf