Full version: jsB@nk » Game » Skill » Type Game
URL: https://www.javascriptbank.com/type-game.html
The object of the game is to type as fast as the computer is spitting out letters.
Full version: jsB@nk » Game » Skill » Type Game
URL: https://www.javascriptbank.com/type-game.html
<script>// Ben Joffe , http://www.joffe.tk/var currentspeed=1500;var difficulty=new Array("25","10", "35")var range=new Array("0", "25", "0")var how;var letters=new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");function writeletters(){if (writearea.innerHTML.substring(0, 1)=="<") writearea.innerHTML="";var ranum=Math.round(Math.random()*difficulty[how]- -range[how])if (currentspeed>50) currentspeed=currentspeed-10;if (writearea.innerHTML.length<15) {writearea.innerHTML=writearea.innerHTML+letters[ranum];setTimeout('writeletters()', currentspeed)} else {endgame()}}function begingame(){currentspeed=1500scorearea.innerHTML="0";how=hardness.options.selectedIndexwriteletters();}function keypress(butpush){if (letters[butpush-65]==writearea.innerHTML.substring(0, 1)) {writearea.innerHTML=writearea.innerHTML.substring(1, writearea.innerHTML.length);scorearea.innerHTML=scorearea.innerHTML- -1}var numbers2=new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");if (numbers2[butpush-48]==writearea.innerHTML.substring(0, 1)){writearea.innerHTML=writearea.innerHTML.substring(1, writearea.innerHTML.length);scorearea.innerHTML=scorearea.innerHTML- -1}}var doeeee=1;function showwait(){if (doeeee==1){waiting.innerHTML="_";doeeee=0;}else {waiting.innerHTML=" ";doeeee=1;}setTimeout('showwait()', 500)}function endgame(){writearea.innerHTML='<input type="button" value="Begin Game" onclick=begingame()> <select id=hardness size="1"><option>Letters</option><option>Numbers</option><option>Letters And Numbers</option></select>'}</script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<body onkeypress="if (event.keyCode > 96 && event.keyCode < 123) event.keyCode=event.keyCode-32; keypress(event.keyCode)" onload="focus();showwait();endgame()"><p><span id="writearea"></span><span id="waiting"></span></p><p>Score = <span id="scorearea">0</span></body><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->