The Essential Guide to HTML5

(Greg DeLong) #1

THE MEMORY (AKA CONCENTRATION) GAME


}


}


function init(){


ctx = document.getElementById('canvas').getContext('2d');


canvas1 = document.getElementById('canvas');


canvas1.addEventListener('click',choose,false);


makedeck();


shuffle();


ctx.font="bold 20pt sans-serif"; Set font^


ctx.fillText("Click on two cards to make a match.",10,20); Display instructions
as text on canvas


ctx.fillText("Number of matches so far: 0",10,360); Display the count


starttime = new Date();


starttime = Number(starttime.getTime());


}






Your browser doesn't support the HTML5 element canvas.




(^)
Free download pdf