\n' document.write(temp); var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; var randm= new Array(4); var input= new Array(4); var counter=0; var round=0; function mm_DoFSCommand(cmd, arg) { var map = InternetExplorer ? mm : document.embeds[0]; var temp=0; if (cmd=="button") { temp=parseInt(arg); input[counter]=temp; map.TGotoFrame("_flash0/r" + round + "s" + counter,temp*10); map.TPlay("_flash0/r" + round + "s" + counter); ++counter; if (counter==4){ newRoundID=setTimeout("newRound()",650); } } if (cmd=="new"){ init(); } } function newRound() { var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; var map = InternetExplorer ? mm : document.embeds[0]; var cpos=0; var ccol=0; var test=0; var checkeda= new Array(4); var checkedb= new Array(4); for (q=0;q<4;++q){ checkeda[q]=0; checkedb[q]=0; if (randm[q]!=input[q]){ ++test; } } if (test==0){ map.GotoFrame(60); map.Play(); }else{ if (round==9){ map.GotoFrame(100); map.Play(); loseID = setTimeout("lose()",3000); } } for (j=0;j<4;++j){ if (input[j]==randm[j]){ ++cpos; checkeda[j]=1; checkedb[j]=1; } } for (i=0;i<4;++i){ for (h=0;h<4;++h){ if ((input[i]==randm[h])&&(checkeda[i]==0)&&(checkedb[h]==0)){ ++ccol; checkeda[i]=1; checkedb[h]=1; h=5; } } } map.TGotoFrame("_flash0/r" + round + "h1", (cpos+1)*10); map.TPlay("_flash0/r" +round+"h1"); map.TGotoFrame("_flash0/r" + round + "h2", (ccol+1)*10); map.TPlay("_flash0/r" +round+"h2"); counter=0; ++round; } function lose(){ var map = InternetExplorer ? mm : document.embeds[0]; map.TGotoFrame("_flash0/l1", (randm[0]*10)); map.TPlay("_flash0/l1"); map.TGotoFrame("_flash0/l2", (randm[1]*10)); map.TPlay("_flash0/l2"); map.TGotoFrame("_flash0/l3", (randm[2]*10)); map.TPlay("_flash0/l3"); map.TGotoFrame("_flash0/l4", (randm[3]*10)); map.TPlay("_flash0/l4"); } function init(){ round=0; counter=0; randm[0]=Math.round(Math.random()*5)+1; randm[1]=Math.round(Math.random()*5)+1; randm[2]=Math.round(Math.random()*5)+1; randm[3]=Math.round(Math.random()*5)+1; } //-->
|
|
||
|
|
||
Thèmes en rapport |
||
Jeux du Puzzle\n' document.write(temp); var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; var matchtowin = new Array(4); var gameboard = new Array(4); function init(){ matchtowin[0] = new Array(4); matchtowin[1] = new Array(4); matchtowin[2] = new Array(4); matchtowin[3] = new Array(4); gameboard[0] = new Array(4); gameboard[1] = new Array(4); gameboard[2] = new Array(4); gameboard[3] = new Array(4); var beenthere= new Array(16); for (x=0;x<16;++x){ beenthere[x]=0; } for (y=0;y<4;++y){ for (x=0;x<4;++x){ test=Math.round(Math.random()*15); while (beenthere[test]!=0){ test=Math.round(Math.random()*15); } beenthere[test]=1; gameboard[y][x]=test; matchtowin[y][x]=y*4+x; } } update(); } function findx(piece){ var temp=0; for (y=0;y<4;++y){ for (x=0;x<4;++x){ if (gameboard[y][x]==piece){ temp=x; } } } return temp; } function findy(piece){ var temp=0; for (y=0;y<4;++y){ for (x=0;x<4;++x){ if (gameboard[y][x]==piece){ temp=y; } } } return temp; } function move(piece){ var puzzleObj = InternetExplorer ? puzzle : document.puzzle; var movex, movey, blankx, blanky, temp, dir=0; movex=findx(piece); movey=findy(piece); blankx=findx(15); blanky=findy(15); if (movey>0){ if ((movex==blankx)&&(movey-1==blanky)){ dir=1; } } if (movex>0){ if ((movex-1==blankx)&&(movey==blanky)){ dir=2; } } if (movey<3){ if ((movex==blankx)&&(movey+1==blanky)){ dir=3; } } if (movex<3){ if ((movex+1==blankx)&&(movey==blanky)){ dir=4; } } if (dir!=0){ puzzleObj.TGotoFrame("_flash0/"+movey+movex, (((piece+1)*100)/2 + (5*dir))); puzzleObj.TPlay("_flash0/"+movey+movex); temp=gameboard[movey][movex] gameboard[movey][movex]=gameboard[blanky][blankx]; gameboard[blanky][blankx]=temp; } } function update(){ var puzzleObj = InternetExplorer ? puzzle : document.puzzle; for (y=0;y<4;++y){ for (x=0;x<4;++x){ puzzleObj.TGotoFrame("_flash0/"+y+x, ((gameboard[y][x]+1)*100)/2); } } } function puzzle_DoFSCommand(command, args) { var puzzleObj = InternetExplorer ? puzzle : document.puzzle; if (command=="slide"){ temp=parseInt(args); move(temp); } if (command=="update"){ update(); } if (command=="init"){ init(); } } //-->
Conçu et réalisé par AQUAMAN |
|
|
|
||
|
|
||