以下这些FLASH8中的代码是什么意思? 20
如果你愿意告诉我的话,还请你正确无误地说清每行的代码意思。具体代码为:(“..........”是为了把每段代码隔开)onClipEvent(load){speed=15...
如果你愿意告诉我的话,还请你正确无误地说清每行的代码意思。
具体代码为:(“..........”是为了把每段代码隔开)
onClipEvent (load) {
speed=15;
}
onClipEvent (enterFrame) {
if(!_root.shipDead){
if(this.hitTest(_root.ship)){
_root.ship.play();
_root.life-=5;
removeMovieClip (this)
}
_x-=speed;
if(_x<-10 ){removeMovieClip(this)}
}
}
.................................................
onClipEvent (load) {
sy=random (400)+10;
function reset(){
ship1.gotoAndStop(1);
speed=random(10)+2;
_y= random(300)+_height;
_x= 550+_y;
_root.firePower=100;
}
reset()
}
onClipEvent (enterFrame) {
if(this.ship1._currentframe==1){
_y = sy + speed * Math.cos(speed+=0.092);
if(this.hitTest(_root.ship)){
ship1.gotoAndStop(2);
_root.ship.play();
_root.life-=10;
}
if(random(_root.firePower)+1==10){
Count++;
depth=(Count%100)+200
duplicateMovieClip(_root.enemyLaser, "num"+Count, depth);
_root["num"+Count]._x=this._x-40
_root["num"+Count]._y=this._y
}
}
_x-=speed
if(_x<-10){ reset()}
}
....................................................................
onClipEvent (load) {
speed=6;
sy=_y;
ang=0;
}
onClipEvent (enterFrame) {
_y = sy + 4 * Math.cos(ang+=0.092);
c=_root.score;
if(c==500){
_root.gotoAndStop(3);
}
if(_root.life<=0){
_root.gotoAndStop(1);
}
if (Key.isDown(Key.DOWN)and _y<400) {_y += speed;sy+=speed}
if (Key.isDown(Key.UP) and _y>80) {_y -= speed;sy-=speed}
if (Key.isDown(Key.RIGHT) and _X<550) {_x += speed;}
if (Key.isDown(Key.LEFT) and _X>0) {_x -= speed;}
if (Key.isDown(Key.SPACE)) {
if (!a) {
shotCount++;
depth=(shotCount%100)+100
_root.attachMovie("laser", "sparo"+shotCount, depth);
_root["sparo"+shotCount]._x = this._x+(_width-45)
_root["sparo"+shotCount]._y = this._y;
a = true;
}
} else {
a = false;}
}
......................................................
enemyNumber=5 //每次画面中出现五个敌人
for(i=0;i<enemyNumber;i++) { //如果画面中敌人数小于五,则复制出敌人的影片剪辑
duplicateMovieClip("enemy","new"+i,30+i)
}
life=100 //生命值为100
score=0; //开始得分为 0
stop( );
.................................................
on (release) { //释放鼠标时,退出游戏
fscommand("quit", "1");
}
..................................
function clean() {
for (i in _root) {
_root[i].removeMovieClip();
}
}
_root.clean();
Mouse.show();
stop(); 展开
具体代码为:(“..........”是为了把每段代码隔开)
onClipEvent (load) {
speed=15;
}
onClipEvent (enterFrame) {
if(!_root.shipDead){
if(this.hitTest(_root.ship)){
_root.ship.play();
_root.life-=5;
removeMovieClip (this)
}
_x-=speed;
if(_x<-10 ){removeMovieClip(this)}
}
}
.................................................
onClipEvent (load) {
sy=random (400)+10;
function reset(){
ship1.gotoAndStop(1);
speed=random(10)+2;
_y= random(300)+_height;
_x= 550+_y;
_root.firePower=100;
}
reset()
}
onClipEvent (enterFrame) {
if(this.ship1._currentframe==1){
_y = sy + speed * Math.cos(speed+=0.092);
if(this.hitTest(_root.ship)){
ship1.gotoAndStop(2);
_root.ship.play();
_root.life-=10;
}
if(random(_root.firePower)+1==10){
Count++;
depth=(Count%100)+200
duplicateMovieClip(_root.enemyLaser, "num"+Count, depth);
_root["num"+Count]._x=this._x-40
_root["num"+Count]._y=this._y
}
}
_x-=speed
if(_x<-10){ reset()}
}
....................................................................
onClipEvent (load) {
speed=6;
sy=_y;
ang=0;
}
onClipEvent (enterFrame) {
_y = sy + 4 * Math.cos(ang+=0.092);
c=_root.score;
if(c==500){
_root.gotoAndStop(3);
}
if(_root.life<=0){
_root.gotoAndStop(1);
}
if (Key.isDown(Key.DOWN)and _y<400) {_y += speed;sy+=speed}
if (Key.isDown(Key.UP) and _y>80) {_y -= speed;sy-=speed}
if (Key.isDown(Key.RIGHT) and _X<550) {_x += speed;}
if (Key.isDown(Key.LEFT) and _X>0) {_x -= speed;}
if (Key.isDown(Key.SPACE)) {
if (!a) {
shotCount++;
depth=(shotCount%100)+100
_root.attachMovie("laser", "sparo"+shotCount, depth);
_root["sparo"+shotCount]._x = this._x+(_width-45)
_root["sparo"+shotCount]._y = this._y;
a = true;
}
} else {
a = false;}
}
......................................................
enemyNumber=5 //每次画面中出现五个敌人
for(i=0;i<enemyNumber;i++) { //如果画面中敌人数小于五,则复制出敌人的影片剪辑
duplicateMovieClip("enemy","new"+i,30+i)
}
life=100 //生命值为100
score=0; //开始得分为 0
stop( );
.................................................
on (release) { //释放鼠标时,退出游戏
fscommand("quit", "1");
}
..................................
function clean() {
for (i in _root) {
_root[i].removeMovieClip();
}
}
_root.clean();
Mouse.show();
stop(); 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询