flash贪吃蛇源码的注释

stop();//停止播放影片init();mc1._x=300;mc1._y=400+mcMain._height;for(i=2;i<=tc;i++){mcMain.... stop();//停止播放影片
init();
mc1._x = 300;
mc1._y = 400+mcMain._height;
for (i=2; i<=tc; i++) {
mcMain.duplicateMovieClip("mc"+i,100+i);
tempMc = eval("mc"+i);
tempMc._x = 300;
tempMc._y = 400+(i*mcMain._height);
}
fnDisplayApple();
mc1.onKeyDown = function() {
if (gameOver == 0) {
dir = Key.getCode();
}
};
mc1.onEnterFrame = function() {
if (gameOver == 0) {
timer();
//dir = Key.getCode();
switch (dir) {
case 37 :
mc1._x -= wid;
mc1._rotation = -90;
break;
case 39 :
mc1._x += wid;
mc1._rotation = 90;
break;
case 38 :
mc1._y -= wid;
mc1._rotation = 0;
break;
case 40 :
mc1._y += wid;
mc1._rotation = 180;
break;
default :
mc1._y -= wid;
mc1._rotation = 0;
break;
}
dirOld = dir;
if (mc1.hitTest(touch1)) {
score++;
txtScore.text = score;
tc++;
mcMain.duplicateMovieClip("mc"+tc, 100+tc);
eval("mc"+tc).onEnterFrame = aa;
touch1._y = 2000;
dispA = setInterval(fnDisplayApple, 300);
} else {
for (i=2; i<=tc; i++) {
tempMc = eval("wall"+(i-1));
if (mc1.hitTest(tempMc)) {
fnGameOver(4);
break;
}
tempMc = eval("mc"+(i+1));
if (mc1.hitTest(tempMc)) {
fnGameOver(4);
break;
}
}
}
}
};
function aa() {
if (gameOver == 0) {
objNum = this._name.substr(2);
this._x = eval("mc"+(objNum-1))._x;
this._y = eval("mc"+(objNum-1))._y;
this._rotation = eval("mc"+(objNum-1))._rotation;
}
}
for (i=2; i<=tc; i++) {
eval("mc"+i).onEnterFrame = aa;
}
OldTime = getTimer();
function timer() {
newTime = getTimer();
if (newTime-oldTime>1000) {
sec++;
if (sec>=60) {
min++;
sec = 0;
fnGameOver(5);
}
var ts = "0"+sec;
var tm = "0"+min;
sec = ts.substr(-2);
min = tm.substr(-2);
txtTime.text = min+":"+sec;
sec = parseInt(ts.substr(-2), 10);
min = parseInt(tm.substr(-2), 10);
oldTime = getTimer();
}
}
function fnGameOver(val) {
clearInterval(dispA);
gameOver = 1;
mcMessages.gotoAndStop(val);
}
function fnDisplayApple() {
ranX = random((wall2._x-wall2._width/2)-(wall4._x+wall4._width/2)-touch1._width)+touch1._width/2+wall4._x+wall4._width/2;
ranY = random((wall3._y-wall3._height/2)-(wall1._y+wall1._height/2)-touch1._height)+touch1._height/2+wall1._y+wall1._height/2;
touch1._x = ranX;
touch1._y = ranY;
clearInterval(dispA);
}
function init() {
Key.addListener(mc1);
min = 0;
sec = 0;
txtTime.text = "00:00";
score = 0;
wid = mcMain._height+1;
tc = 5;
gameOver = 0;
dir = 38;
txtScore.text = 0;
mcMain.duplicateMovieClip("mc", 1);
for (i=1; i<=4; i++) {
eval("wall"+i).swapDepths(1000+i);
}
}
就是对源程序的注释,希望写得清楚一点啊,每一个函数什么意思。真的很急啊,大家快啊,谢谢
展开
 我来答
百度网友9494f74
2008-12-19 · TA获得超过181个赞
知道小有建树答主
回答量:480
采纳率:0%
帮助的人:419万
展开全部
把原文件发到我邮箱:284950276@qq.com

楼主不要急,有空我一定帮你,呵呵

做好后我会发回你邮箱的
AiPPT
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图... 点击进入详情页
本回答由AiPPT提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式