Quantcast
Channel: iT邦幫忙
Viewing all articles
Browse latest Browse all 15645

用JavaScript寫好的小遊戲,請求程式註解

$
0
0
內容是一個連線泡泡球遊戲,請求高手幫我解釋程式的用意,不需每行解釋,只要解釋每一段的程式是在做什麼的即可,盡量白話一點,因字數有限,請加我MSN:miyz3158@hotmail.com,或留下EMAIL,感謝!!
完整檔案載點
http://www.sinocell.com.tw/event/2013/bubble.rar


var canvas;
var ctx;
var mp = {x:-1, y:-1, c:0};
var isStart = false;
var isSel = false;
var isRan = false;
var isEnd = false;
var isActive = false;
var ranArr = new Array();
var moveArr = new Array();
var score=0;
var beginTime;
var endTime;
var circle = Math.PI * 2;
var chessColor = new Array(7);
chessColor[0] = "";
chessColor[1] = "rgb(255, 82, 155)";
chessColor[2] = "rgb(255, 180, 82)";
chessColor[3] = "rgb(82, 255, 167)";
chessColor[4] = "rgb(82, 135, 255)";
chessColor[5] = "rgb(147, 82, 255)";
chessColor[6] = "rgb(255, 34, 34)";
chessColor[7] = "rgb(146, 146, 146)";

var map = new Array(9);
for(var i=0;i<9;i++) map[i] = new Array(9);

function game() {
canvas = document.getElementById("canvas");
if (canvas.getContext) ctx = canvas.getContext("2d");

var lineargradient = ctx.createLinearGradient(0,0,0,450);
lineargradient.addColorStop(0,'#E6E6E6');
lineargradient.addColorStop(1,'#FFF');
ctx.fillStyle = lineargradient;
ctx.fillRect(0,0,450,450);
ctx.strokeStyle = "#CCCCCC";
ctx.strokeRect(0.5,0.5,450,500);

drawChess(232.5,207,Math.floor(Math.random()*7)+1,1);
ctx.font = "20pt Arial";
ctx.fillStyle = "#969696";
ctx.fillText("點這裡開始", 165, 280);
document.getElementById("commentbox").style.left=canvas.offsetLeft+110+"px";
document.getElementById("commentbox").style.top=canvas.offsetTop+125+"px";

document.getElementById("scorebox").style.left=canvas.offsetLeft+12+"px";
document.getElementById("scorebox").style.top=canvas.offsetTop+473+"px";

document.getElementById("restartbox").style.left=canvas.offsetLeft+374+"px";
document.getElementById("restartbox").style.top=canvas.offsetTop+471+"px";
}
.
.
.
.

Viewing all articles
Browse latest Browse all 15645

Trending Articles