找个人给我分析下这些代码都是什么意思
_root.onLoad = function() {
fscommand("showmenu", false);
fscommand("allowscale",false);
gameover = 0;
startgame = 0;
score = 0;
maxnum = 3;
initnum = maxnum;
control = 1;
move = 0;
xrise = 30;
yrise = 0;
this.attachMovie("target", "target1", 50);
for (i=1; i<=maxnum; i++) {
this.attachMovie("square", "square" add i, i);
this["square" add i]._x = 20+i*30;
this["square" add i]._y = 280;
}
randomdisplay();
};
function randomdisplay() {
this["target1"]._x = random(15)*30+50;
this["target1"]._y = random(10)*30+10;
for (i=1; i<=maxnum; i++) {
if (this["square"+i]._x == this["target1"]._x && this["square"+i]._y == this["target1"]._y) {
randomdisplay();
}
}
}
function moving() {
move = 1;
}
_root.onEnterFrame = function() {
allow = 1;
inix = this["square" add maxnum]._x;
iniy = this["square" add maxnum]._y;
if (startgame == 1 and gameover == 0) {
if (Key.isDown(Key.UP) and allow ==1) {
if (control != 4) {
move = 1;
xrise = 0;
yrise = -30;
control = 2;
allow = 0;
}
}
if (Key.isDown(Key.DOWN) and allow == 1) {
if (control != 2) {
move = 1;
xrise = 0;
yrise = 30;
control = 4;
allow = 0;
}
}
if (Key.isDown(Key.RIGHT) and allow == 1) {
if (control != 3) {
move = 1;
xrise = 30;
yrise = 0;
control = 1;
allow = 0;
}
}
|