html5 canvas-2.用canvas制作一个猜字母的小游戏

  function drawScreen() {

  //background

  context.fillStyle = '#ffffaa';

  context.fillRect(0, 0, 500, 300);

  //box

  context.strokeStyle = '#000000';

  context.strokeRect(5, 5, 490, 290);

  context.textBaseLine = 'top';

  //date

  context.fillStyle = '#000000';

  context.font = '10px_sans';

  context.fillText(today, 150, 20);

  //message

  context.fillStyle = '#ff0000';

  context.font = '14px_sans';

  context.fillText(message, 125, 40);

  //guesses

  context.fillStyle = '#109910';

  context.font = '16px_sans';

  context.fillText('Guesses:' + guesses, 215, 60);

  //higher or lower

  context.fillStyle = '#000000';

  context.font = '16px_sans';

  context.fillText('Higher or Lower:' + higherOrLower, 150, 125);

  //letters guessed

  context.fillStyle = '#ff0000';

  context.font = '16px_sans';

  context.fillText('Letters Guessed:' + lettersGuessed.toString(), 10, 260);

  if (gameOver) {

  context.fillStyle = "#FF0000";

  context.font = "40px _sans";

  context.fillText("You Got It!", 150, 180);

  }

  }