首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Flash >

急看不明游戏当

2012-03-09 
急求助!看不明游戏当booM boon man.fla on man.fla http://space.flash8.net/bbs/attachment.php?aid3669

急求助!看不明游戏当
booM boon man.fla

on man.fla http://space.flash8.net/bbs/attachment.php?aid=366954&k=615cbdd9c91a0f14e9b04fb7f90d10b8&t=1300746845&fid=38&sid=d02fX%2BIhp5Zz0FIoGaAETHfQUeQPb5n0re1s8CaGPFmMuJI

先说明以上的文件不是本人,想在网上下来的学习样本,
但看不明白有些地方(为什么要怎样写),(这里是写什么??)等等,希望有人解说...............



1.这里是写什么??)

var bombpower:Number = 1;
//炸弹威力
var bombs:Number = 1;
function GNChitTest(cx:Number, cy:Number) {
if (cy == 0) {
if (_root.map_mc.hitTest(_root.pig_mc._x+cx*20, _root.pig_mc._y+cy*20-15, true) || _root.map_mc.hitTest(_root.pig_mc._x+cx*20, _root.pig_mc._y+cy*20+15, true)) {
return false;
} else {
return true;
}
} else {
if (_root.map_mc.hitTest(_root.pig_mc._x+cx*20-15, _root.pig_mc._y+cy*20, true) || _root.map_mc.hitTest(_root.pig_mc._x+cx*20+15, _root.pig_mc._y+cy*20, true)) {
return false;
} else {
return true;
}
}
}
ditu = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
for (var y = 0; y<=9; y++) {
for (var x = 0; x<=11; x++) {
if (ditu[y][x] == 1) {
_root.map_mc.attachMovie("mc", "x"+x+"y"+y, x*10+y);
_root.map_mc["x"+x+"y"+y]._x = x*40;
_root.map_mc["x"+x+"y"+y]._y = y*40;
}
}
}


2.(這裡是寫炸彈的,但为什么要怎样写),(这里是写什么)



_root.bombs++;
_root.attachMovie("bombfire", "fire", 299);
_root["fire"]._x = this._x;
_root["fire"]._y = this._y;
var tmpl:Boolean = true;
var tmpr:Boolean = true;
var tmpu:Boolean = true;
var tmpd:Boolean = true;
for (var i = 1; i<=_root.bombpower; i++) {
if (tmpl == true) {
_root.attachMovie("bombfire", "fire"+this._name+i+3, i*10+Number(this._name.charAt(4)*300)+3);
_root["fire"+this._name+i+3]._x = this._x-40*i;
_root["fire"+this._name+i+3]._y = this._y;
if (_root.map_mc["x"+(this._x/40-i)+"y"+(this._y/40)]._currentframe == 1) {
_root.map_mc["x"+(this._x/40-i)+"y"+(this._y/40)].removeMovieClip();
tmpl = false;
}
}
if (tmpr == true) {
_root.attachMovie("bombfire", "fire"+this._name+i+1, i*10+Number(this._name.charAt(4)*300)+1);
_root["fire"+this._name+i+1]._x = this._x+40*i;
_root["fire"+this._name+i+1]._y = this._y;
if (_root.map_mc["x"+(this._x/40+i)+"y"+(this._y/40)]._currentframe == 1) {
_root.map_mc["x"+(this._x/40+i)+"y"+(this._y/40)].removeMovieClip();
tmpr = false;
}
}
if (tmpu == true) {
_root.attachMovie("bombfire", "fire"+this._name+i+4, i*10+Number(this._name.charAt(4)*300)+4);
_root["fire"+this._name+i+4]._x = this._x;
_root["fire"+this._name+i+4]._y = this._y-40*i;
if (_root.map_mc["x"+(this._x/40)+"y"+(this._y/40-i)]._currentframe == 1) {
_root.map_mc["x"+(this._x/40)+"y"+(this._y/40-i)].removeMovieClip();
tmpu = false;
}
}
if (tmpd == true) {
_root.attachMovie("bombfire", "fire"+this._name+i+2, i*10+Number(this._name.charAt(4)*300)+2);
_root["fire"+this._name+i+2]._x = this._x;
_root["fire"+this._name+i+2]._y = this._y+40*i;
if (_root.map_mc["x"+(this._x/40)+"y"+(this._y/40+i)]._currentframe == 1) {
_root.map_mc["x"+(this._x/40)+"y"+(this._y/40+i)].removeMovieClip();


tmpd = false;
}
}
}
this.removeMovieClip();

[解决办法]
太长了。。看的眼花,那段貌似是说炸弹爆炸后的火焰效果,以爆炸点为中心开始画火花
bombfire 我理解为一个火花的mc
tmpl,tmpr,tmpu,tmpd 貌似是分别代表左,右,上,下的判定标志

/////////
_root.attachMovie("bombfire", "fire"+this._name+i+3, i*10+Number(this._name.charAt(4)*300)+3);
_root["fire"+this._name+i+3]._x = this._x-40*i;
_root["fire"+this._name+i+3]._y = this._y;
/////////
添加了一个bombfire影片剪辑,然后设置它的名字和位置

/////////
for (var i = 1; i<=_root.bombpower; i++) 
////////
貌似是根据炸弹威力值来做批量处理

/////////
if (_root.map_mc["x"+(this._x/40+i)+"y"+(this._y/40)]._currentframe == 1) {
_root.map_mc["x"+(this._x/40+i)+"y"+(this._y/40)].removeMovieClip();
tmpr = false;
}
/////////
做了一个判断,如果一个叫
map_mc["x"+(this._x/40+i)+"y"+(this._y/40)]
的影片剪辑当前帧号为1,就移除它自己,然后 判定设为false

/////////////////////////////
结论:没有完全仔细看(太长了,还好多他自己命名的变量和mc那一揣摩他的意思) ,
感觉他是做了一个炸弹爆炸后火花效果的添加,
根据炸弹威力,判定火焰效果的范围,然后添加火焰mc到舞台上,
貌似这个火焰mc是个多帧的mc,其实会自行播放,到了帧号为1 的时候自我消失

热点排行