// @open license with citation // @please feel free to reuse this code for any purpose, citing dougx.net // @see http://dougx.net/plunder/license.txt for MIT open license text // // Called from the document, as the
's onload event // also called when the user exits the instructional screen // in which case the revisit flag is set // function bodyLoaded(revisit) { isChr(); if ( !g_soundsLoaded ) { setTimeout(bodyLoaded, 500); return; } var bg = document.getElementById("splash_screen"); var title = document.getElementById("title"); g_context.drawImage(bg,0,0); g_context.drawImage(title,0,0); g_context.fillStyle = "yellow"; g_context.fillText("use arrow keys to move, z to shoot",300,360); g_context.fillText("use p key to pause",300,380); if ( g_highScore != undefined ) { g_context.fillText("High Score: " + g_highScore, 370, 30); } // render the two buttons on the main menu and the ctrls checkbox g_context.fillStyle = "black"; g_context.fillRect(400,283,20,20); //ctrls checkbox g_context.fillRect(50,300,150,30); g_context.strokeStyle = "gray"; g_context.strokeRect(50,300,150,30); g_context.fillStyle = "gray"; g_context.fillText("NEW GAME",73,322); g_context.fillStyle = "black"; g_context.fillRect(50,340,150,30); g_context.strokeStyle = "gray"; g_context.strokeRect(50,340,150,30); g_context.fillStyle = "gray"; g_context.fillText("INSTRUCTIONS",52,361); g_context.strokeRect(400,283,20,20); g_context.fillText("Onscreen Controls",425,300); if ( g_onscreenControls ) { g_context.strokeStyle = "gray"; g_context.beginPath(); g_context.moveTo(400,283); g_context.lineTo(420,303); g_context.stroke(); g_context.beginPath(); g_context.moveTo(420,283); g_context.lineTo(400,303); g_context.stroke(); } g_gameState = "splash"; if ( g_dinkSound == null ) g_dinkSound = new Sound("dink",4); if ( revisit == undefined ) { g_canvas.addEventListener('mousemove', ev_mousemove, false); g_canvas.addEventListener('mousedown', ev_mousedown, false); } } // // called by the document as it loads, individual items in the // ask for this to be called as they load. note that