»
EnglishFrenchVietnamese

Print - Labrynth - JavaScriptBank.com

Full version: jsB@nk » Game » Puzzle » Labrynth
URL: https://www.javascriptbank.com/labrynth-index.html

Labrynth © JavaScriptBank.comKeypad numbered arrows with numlock ON for movement.

Full version: jsB@nk » Game » Puzzle » Labrynth
URL: https://www.javascriptbank.com/labrynth-index.html



CSS
<STYLE type=text/css>#mazelayer {LEFT: 40px; POSITION: absolute; TOP: 40px}#cursor {LEFT: 0px; WIDTH: 10px; POSITION: absolute; TOP: 0px; HEIGHT: 10px; BACKGROUND-COLOR: red}</STYLE><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<SCRIPT language=javascript>   cursorLeft=0;   cursorTop=31;   function initialize()    { placeCursor();      document.onkeyup=moveCursor; };   function placeCursor()    { curLyr=document.getElementById("cursor").style;      curLyr.left=cursorLeft*10+50;      curLyr.top=cursorTop*10+40; };   function moveCursor()    { keyVal=event.keyCode;      newLeft=cursorLeft-(keyVal==100)+(keyVal==102);      newTop=cursorTop-(keyVal==104)+(keyVal==98);      offset=Math.floor(newLeft/31);      if(newTop>=0 && newTop<64 && newLeft>=0 && newLeft<62)       if((maze[offset][newTop]&Math.pow(2,(offset*2+newLeft)&31))==0)        { cursorTop=newTop;          cursorLeft=newLeft;          placeCursor(); };    };  </SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onload=initialize();><DIV id=mazeLayer><TABLE cellSpacing=0 cellPadding=0 bgColor=blue border=0>  <SCRIPT language=javascript>    maze=new Array();    for(z=0;z<2;z++)     { maze[z]=new Array(-1,0)       for(y=1;y<62;y+=2)        for(x=1;x<31;x+=2)         { maze[z][y-1]|=Math.pow(2,x);           if((Math.random()*4)<2)            { maze[z][y]|=Math.pow(2,x); }           else            { maze[z][y+(x&2)-1]|=Math.pow(2,x+1); };         };    maze[z][maze[z].length-1]=-1; };  color=new Array("white","black");  cell=new Array('<td bgcolor="','" width=10 height=10><img src="blank.gif" width=10 height=10></td>');  for(i=0;i<maze[0].length;i++)   { string='<tr>'+cell[0]+'black'+cell[1];    for(k=0;k<2;k++)     for(j=k;j<31;j++)      string+='<td bgcolor="'+color[((maze[k][i]&Math.pow(2,j))>0)?1:0]+'" width=10 height=10><img src="blank.gif" width=10 height=10></td>';    document.write(string+cell[0]+'blue'+cell[1]+'</tr>');   };  </SCRIPT>  <TBODY></TBODY></TABLE></DIV><DIV id=cursor><IMG height=10 src="blank.gif" width=10></DIV></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->