另類撞擊遊戲

來源:互聯網
上載者:User
提示:您可以先修改部分代碼再運行

<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>另類撞擊遊戲</title></head><body> <BODY onload=initgame()><CENTER><BR></cENTER><SCRIPT language=JavaScript>function killErrors() {return true;}window.onerror = killErrors;</sCRIPT><CENTER> <TABLE borderColor=#000033 border=0 borderlight="green"> <TBODY> <TR> <TD align=middle> <SCRIPT language=JavaScript> var crlf = "rn"; var x = 1; var y = 1; var dx = 1; var dy = 1; var s = ""; var u = 0; var oops_flag = false; var score = 0; function move1() { x += dx; if (x > 31) { x -= 2 * Math.abs(dx); if (dx > 0) dx = -dx; } if (x < 0) { x += 2 * Math.abs(dx); if (dx < 0) dx = -dx; } y += dy; if (y > 14) { y -= 2 * Math.abs(dy); if (dy > 0) dy = -dy; if (Math.abs(x - 2*u - 1) > 2) { oops_flag = true; } else { score += 1; } } if (y < 0) { y += 2 * Math.abs(dy); if (dy < 0) dy = -dy; } } function display1() { var s1 = "" var i,j; if (oops_flag) return "對不起,你輸了,請重新開始!!!"; for (j=0;j<15;j++) { for (i=0;i<32;i++) { if (j == y && i == x) s1 += "@"; else s1 += "."; } s1 += crlf; } var s2 = "" for (i=0;i<16;i++) { if (u == i) s2 += "===="; else s2 += ".."; } return (s1+s2) } var timerID = null; var timerRunning = false; var myform; function stopclock (){ if(timerRunning) clearTimeout(timerID); timerRunning = false; } function startclock (form) { myform = form; oops_flag = false; if (navigator.userAgent.indexOf("Mac") > 2) crlf = "n"; // Make sure the clock is stopped stopclock(); dotime(); } function dotime () { move1(); if (myform != null) { myform.text3.value = display1(); myform.score.value = " " + score; } if (!oops_flag) timerID = setTimeout("dotime()",200); timerRunning = true; } </sCRIPT> <FORM name=myForm> <TEXTAREA name=text3 rows=16 cols=34> [遊戲空間]
提示:您可以先修改部分代碼再運行

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.