function draw() {
  switch(gameMode) {
    case 0:
      canvas.clearRect(0, 0, 512, 256);       // clear the canvas
      canvas.fillStyle="#000000";
      canvas.fillRect(0,0,512,256);


      renderMap();

      canvas.fillStyle="#232323";
      canvas.fillRect(50,50,(CANVAS_WIDTH - 100),(CANVAS_HEIGHT - 100));

      canvas.strokeStyle = "#777777";
      canvas.rect(50,50,(CANVAS_WIDTH - 100),(CANVAS_HEIGHT - 100));
      canvas.stroke();

      canvas.fillStyle = "white";
      canvas.font = "20px Bungee Shade";
      canvas.fillText("Canvas Test",60,70);

      canvas.font = "15px Bungee Shade";
      canvas.fillText("Enter the game by pressing enter.",60,90);
      canvas.fillText("The game controls are A, D, and space.",60,110);
      break;
    case 1:
      canvas.clearRect(0, 0, 512, 256);       // clear the canvas
      canvas.fillStyle="#000000";
      canvas.fillRect(0,0,512,256);

      renderMap();

      player.draw();

      break;
    default:
      break;
  }
}
// this is the main drawing function
this is the main drawing function
this is the main drawing function
function draw() {
  switch(gameMode) {
    case 0:
      canvas.clearRect(0, 0, 512, 256);       
      canvas.fillStyle="#000000";
      canvas.fillRect(0,0,512,256);
      renderMap();
      canvas.fillStyle="#232323";
      canvas.fillRect(50,50,(CANVAS_WIDTH - 100),(CANVAS_HEIGHT - 100));
      canvas.strokeStyle = "#777777";
      canvas.rect(50,50,(CANVAS_WIDTH - 100),(CANVAS_HEIGHT - 100));
      canvas.stroke();
      canvas.fillStyle = "white";
      canvas.font = "20px Bungee Shade";
      canvas.fillText("Canvas Test",60,70);
      canvas.font = "15px Bungee Shade";
      canvas.fillText("Enter the game by pressing enter.",60,90);
      canvas.fillText("The game controls are A, D, and space.",60,110);
      break;
    case 1:
      canvas.clearRect(0, 0, 512, 256);       
      canvas.fillStyle="#000000";
      canvas.fillRect(0,0,512,256);
      renderMap();
      player.draw();
      break;
    default:
      break;
  }
}
function draw ( ) { switch ( gameMode ) { case 0 : canvas . clearRect ( 0 , 0 , 512 , 256 ) ; canvas . fillStyle = "#000000" ; canvas . fillRect ( 0 , 0 , 512 , 256 ) ; renderMap ( ) ; canvas . fillStyle = "#232323" ; canvas . fillRect ( 50 , 50 , ( CANVAS_WIDTH - 100 ) , ( CANVAS_HEIGHT - 100 ) ) ; canvas . strokeStyle = "#777777" ; canvas . rect ( 50 , 50 , ( CANVAS_WIDTH - 100 ) , ( CANVAS_HEIGHT - 100 ) ) ; canvas . stroke ( ) ; canvas . fillStyle = "white" ; canvas . font = "20px Bungee Shade" ; canvas . fillText ( "Canvas Test" , 60 , 70 ) ; canvas . font = "15px Bungee Shade" ; canvas . fillText ( "Enter the game by pressing enter." , 60 , 90 ) ; canvas . fillText ( "The game controls are A, D, and space." , 60 , 110 ) ; break ; case 1 : canvas . clearRect ( 0 , 0 , 512 , 256 ) ; canvas . fillStyle = "#000000" ; canvas . fillRect ( 0 , 0 , 512 , 256 ) ; renderMap ( ) ; player . draw ( ) ; break ; default : break ; } }
this is the main drawing function
this is the main drawing function
// clear the canvas // clear the canvas