»
Tiếng AnhTiếng PhápTiếng Việt

In - Tìm đường trong mê cung - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Trò chơi » Giải đố » Tìm đường trong mê cung
URL: https://www.javascriptbank.com/maze-index.html

Tìm đường trong mê cung © JavaScriptBank.comTrò chơi JavaScript JavaScript tạo ra vô số đường đi và nhiệm vụ của bạn là tìm ra đường đúng trong vô số các đường đó.

Phiên bản đầy đủ: jsB@nk » Trò chơi » Giải đố » Tìm đường trong mê cung
URL: https://www.javascriptbank.com/maze-index.html



CSS
<style>IMG.maze {height:16;width:16;border:0;}</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">var px=1,py=1,maps,lv,nm=0,pl=0,level=0;var pageloc = location.hreffor (t = pageloc.length-1;t>=0;t--){if (pageloc.charAt(t) == "/") {pageloc = pageloc.substring(0,t+1)t = -1}}pageloc = pageloc.toLowerCase();maps  = "X#   # #   #  G;" // 1maps += " # ###   #   ##;" // 2maps += " #  #  ########;" // 3maps += " ## # ##   #   ;" // 4maps += "    #    #   # ;" // 5maps += "### ########## ;" // 6maps += "         #   # ;" // 7maps += " #######   # # ;" // 8maps += " #       ### # ;" // 9maps += " # ########### ;" // 10maps += " ###   ##   #  ;" // 11maps += "     # ## #   #;" // 12maps += "######  # #####;" // 13maps += "#######   #####;" // 14maps += "###############;" // 15maps += "|"maps += "     ###       ;" // 1maps += "  ####G# ##### ;" // 2maps += "    ## ####### ;" // 3maps += " ## ##         ;" // 4maps += "     ###   ####;" // 5maps += "  #### # ###   ;" // 6maps += "       # #   # ;" // 7maps += " #######   # # ;" // 8maps += " #       ### # ;" // 9maps += " # ########### ;" // 10maps += " ###   ##   #  ;" // 11maps += "     # ####   #;" // 12maps += "######  #  ####;" // 13maps += "#######   #####;" // 14maps += "##      #     X;" // 15numlevs = 1minmvs = 73function start(){pl=1nm=0map = maps.split("|")[0].split(";");for (y=0;y<=14;y++) {for (x=0;x<=14;x++) {tmp = map[y];tmp = tmp.charAt(x)tmp = tmp.toUpperCase();im = document.all['maze' + (x+1) + '_' + (y+1)]if (tmp == "X") {px = x + 1py = y + 1im.src = "p.gif"} else if (tmp == "#") {im.src = "w.gif"} else if (tmp == "G") {im.src = "g.gif"} else {im.src = "n.gif"}}}}function goal(){if (level >= numlevs) {alert("You Traveled through All Of Thyme in " + nm + " Movements!" + ((nm <= minmvs)?"\nTHAT'S A PERFECT SCORE!!!":""));nm = 0level = -1} else {alert("Prepare To Travel Through Thyme and Go To The Next Level!");}level++map = maps.split("|")[level].split(";");for (y=0;y<=14;y++) {for (x=0;x<=14;x++) {tmp = map[y];tmp = tmp.charAt(x)tmp = tmp.toUpperCase();im = document.all['maze' + (x+1) + '_' + (y+1)]if (tmp == "X") {px = x + 1py = y + 1im.src = "p.gif"} else if (tmp == "#") {im.src = "w.gif"} else if (tmp == "G") {im.src = "g.gif"} else {im.src = "n.gif"}}}}function clickMove(x,y){var cx=0, cy=0if (x > px)cx = 1if (x < px)cx = -1if (y > py)cy = 1if (y < py)cy = -1pMove(cx,cy);}function keyUp() {k = String.fromCharCode(event.keyCode).toLowerCase();if (pl != 1)return true;var cx=0,cy=0;if (k == "1" || k == "a" || k == "#") {cx = -1cy = 1} else if (k == "2" || k == "(" || k == "b") {cy = 1} else if (k == "3" || k == "c" || k == '"') {cx = 1cy = 1} else if (k == "4" || k == "%" || k == "d") {cx = -1} else if (k == "6" || k == "'" || k == "f") {cx = 1} else if (k == "7" || k == "$" || k == "g") {cx = -1cy = -1} else if (k == "8" || k == "&" || k == "h") {cy = -1} else if (k == "9" || k == "i" || k == "!") {cx = 1cy = -1}pMove(cx,cy)}function pMove(cx,cy) {nx = px + cxny = py + cyif (nx > 15 || nx < 1 || ny > 15 || ny < 1) {alert("You Hit A Wall!");} else {imto = document.all['maze' + nx + '_' + ny]imfrom = document.all['maze' + px + '_' + py]if (imto.src.toLowerCase() == "w.gif" || imto.src.toLowerCase() == pageloc + "w.gif") {alert("You Hit a Wall!");} else if (imto.src.toLowerCase() == "g.gif" || imto.src.toLowerCase() == pageloc + "g.gif") {imfrom.src = "n.gif"imto.src = "p.gif"px = nxpy = nygoal();} else {imfrom.src = "n.gif"imto.src = "p.gif"px = nxpy = ny}}nm++self.focus()}document.onkeyup=keyUp;</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<body bgcolor=black text=white background="darkbluebg.gif"><table border=0><tr><td valign=top width=280><script language="javascript"><!--document.write("<img src='thyme." + "j" + "p" + "g" + "'><br>");//--></script><font style="font-size:12pt;">Welcome to The Maze Of Thyme...</font><br><br><font style="font-size:10pt;">In this Maze you are the multi-colored square and your goal is to get to the G.<br>Move using the buttons on the number key-pad to the right of your keyboard it doesn't matter if NumLock is on or not<br>Last but not least... Have Fun...<br><br></font><font color="#ff0000" style="font-size:8pt;">This Script Was Written Entirely By Jason DiOrio.<br>If You Would Like To Use This Script on Your Site You May Do So, But Please Leave This Message Attached</font></td><td><script language="Javascript"><!-- Begin Script Cloakervar w,y,x;document.write("<table border=0 cellpadding=0 cellspacing=0>\n");document.write("<tr>\n");for (w=1;w<=17;w++){document.write("<td><img src='w.gif' class='maze'></td>\n");}document.write("</tr>\n");for (y=1;y<=15;y++) {document.write("<tr>\n<td><img src='w.gif'></td>\n");for (x=1;x<=15;x++){document.write("<td><a href='javascript:void(0);' onClick='clickMove(" + x + "," + y + ");'><img src='n.gif' id='maze" + x + "_" + y + "' class='maze'></a></td>\n");}document.write("<td><img src='w.gif'></td>\n</tr>\n");}document.write("<tr>\n");for (w=1;w<=17;w++){document.write("<td><img src='w.gif' class='maze'></td>\n");}document.write("</tr>\n</table>\n");document.all['maze1_1'].src="p.gif"document.all['maze15_15'].src="g.gif"start();//End Of Cloaker --></script></td></tr></table></p></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/game/maze/maze_images.zip