Full version: jsB@nk » Game » Puzzle » Concentration - Using Different Images
URL: https://www.javascriptbank.com/concentration-using-differance-images-index.html
Memory game where you try to remember where the matching tiles are.
Full version: jsB@nk » Game » Puzzle » Concentration - Using Different Images
URL: https://www.javascriptbank.com/concentration-using-differance-images-index.html
<style type="text/css">body{background-color:#ffffff;font-size:10pt;color:#00436e;font-family:sans-serif;}</style><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<script language="javascript">/*ORIGINAL SCRIPT CREATED Brian Gosselin OF http://scriptasylum.comEDITED BY Michael Rottmeier OF http://michael-rottmeier.bei.t-online.deTHIS VERSION ADDS THE ABILTY TO MATCH DIFFERENT BUT RELATED IMAGESINSTEAD OF THE SAME IMAGE.*/var pics=new Array();for(i=1;i<=18;i++){pics[i]=new Image();pics[i].src='K_image'+i+'.gif';}for(i=83;i<=100;i++){pics[i]=new Image();pics[i].src='K_image'+i+'.gif';}var map=new Array(18, 83, 17, 84, 16, 85, 15, 86, 14, 87, 13, 88, 12, 89, 11, 90, 10, 91, 9, 92, 8, 93, 7, 94, 6, 95, 5, 96, 4, 97, 3, 98, 2, 99, 1, 100)var user=new Array();var temparray=new Array();var clickarray=new Array(0,0);var ticker, sec, min, ctr, id=0, oktoclick, finished;function init(){clearTimeout(id);for(i=0;i<=35;i++)user[i]=0;ticker=0; min=0; sec=0; ctr=0; finished=0;oktoclick=true;document.forms["f"].b.value=" Start ";scramble();id=setInterval('runclk()', 995);for(i=0;i<=35;i++){document.images[('img'+i)].src="K_image0.gif";document.images[('img'+i)].alt="";}}function runclk(){min=Math.floor(ticker/60);sec=(ticker-(min*60))+'';if(sec.length==1){sec="0"+sec};ticker++;document.forms["f"].b.value=" "+min+":"+sec+" ";}function scramble(){for(z=0;z<5;z++){for(x=0;x<=35;x++){temparray[0]=Math.floor(Math.random()*36);temparray[1]=map[temparray[0]];temparray[2]=map[x];map[x]=temparray[1];map[temparray[0]]=temparray[2];}}}function showimage(but){if(oktoclick){oktoclick=false; document.images[('img'+but)].src='K_image'+map[but]+'.gif';document.images[('img'+but)].alt='Image '+map[but];if(ctr==0){ctr++;clickarray[0]=but;oktoclick=true;}else{clickarray[1]=but;ctr=0;setTimeout('returntoold()', 600);}}}function returntoold(){if((clickarray[0]==clickarray[1])&&(!user[clickarray[0]])){document.images[('img'+clickarray[0])].src="K_image0.gif";document.images[('img'+clickarray[0])].alt="";oktoclick=true;}else{if((Math.floor(map[clickarray[0]] + map[clickarray[1]])) != 101){if(user[clickarray[0]]==0){document.images[('img'+clickarray[0])].src="K_image0.gif";document.images[('img'+clickarray[0])].alt="";}if(user[clickarray[1]]==0){document.images[('img'+clickarray[1])].src="K_image0.gif";document.images[('img'+clickarray[1])].alt="";}}if((Math.floor(map[clickarray[0]] + map[clickarray[1]])) == 101){if(user[clickarray[0]]==0&&user[clickarray[1]]==0){finished++; }user[clickarray[0]]=1;user[clickarray[1]]=1;}if(finished >= 18){alert('Well, done in '+document["f"].b.value+'. Great !');/// Change Value of the ClockclearTimeout(id);document.forms["f"].b.value = 'Newstart';/// End}else{oktoclick=true;}}}//window.onload=init;</script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<table cellpadding="2" cellspacing="0" border="1"><tr><td width="25">1</td><td width="25">2</td><td width="25">3</td><td width="25">4</td><td width="25">5</td><td width="25">6</td><td width="25">7</td><td width="25">8</td><td width="25">9</td><td width="25">10</td><td width="25">11</td><td width="25">12</td><td width="25">13</td><td width="25">14</td><td width="25">15</td><td width="25">16</td><td width="25">17</td><td width="25">18</td></tr><tr><td>100</td><td>99</td><td>98</td><td>97</td><td>96</td><td>95</td><td>94</td><td>93</td><td>92</td><td>91</td><td>90</td><td>89</td><td>88</td><td>87</td><td>86</td><td>85</td><td>84</td><td>83</td></tr></table><br><br><table cellpadding="0" cellspacing="0" border="0"><script language="javascript">var t='';for(r=0;r<=5;r++){t+='<tr>';for(c=0;c<=5;c++){t+='<td align="center"><a href="javascript:showimage('+((6*r)+c)+')" onClick="this.blur()"><img src="K_image0.gif" name="img'+((6*r)+c)+'" alt="" border="0" width=68></a></td>';}t+='</tr>';}document.write(t);</script></table><br><br><form name="f"><input type="button" value=" Start " name="b" onClick="init()"></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
http://javascriptbank.com/javascript/game/Concentration_Using_Differance_Images/Concentration_Using_Differance_Images.zip