(3)问题集飞出舞台的代码如下: //问题集飞出舞台的起始位置和方向 _root.mcnum0.onEnterFrame = function() { };
_root.mcnum1.onEnterFrame = function() { };
_root.mcnum2.onEnterFrame = function() { };
_root.mcnum3.onEnterFrame = function() { };
if (_root.mcnum3._x>600) {
_root.mcnum3._x = 600; if (_root.mcnum2._x>600) {
_root.mcnum2._x = 600; if (_root.mcnum1._x>600) {
_root.mcnum1._x = 600; if (_root.mcnum0._x>600) {
_root.mcnum0._x = 600;
} else { }
_root.mcnum0._x += 3.5;
} else { }
_root.mcnum1._x += 2.5;
} else { }
_root.mcnum2._x += 2.5;
} else { }
_root.mcnum3._x += 2.5;
_root.mcnum4.onEnterFrame = function() { };
_root.mcnum5.onEnterFrame = function() { };
_root.mcnum6.onEnterFrame = function() { };
_root.mcnum7.onEnterFrame = function() { };
_root.mcnum8.onEnterFrame = function() {
if (_root.mcnum8._x>600) { if (_root.mcnum7._x>600) {
_root.mcnum7._x = 600; if (_root.mcnum6._x>600) {
_root.mcnum6._x = 600; if (_root.mcnum5._x>600) {
_root.mcnum5._x = 600; if (_root.mcnum4._x>600) {
_root.mcnum4._x = 600;
} else { }
_root.mcnum4._x += 2.5;
} else { }
_root.mcnum5._x += 2.5;
} else { }
_root.mcnum6._x += 2.5;
} else { }
_root.mcnum7._x += 2.5;
};
_root.mcnum8._x = 600;
} else { }
_root.mcnum8._x += 2.5;
(4)游戏结束的代码测试与关数2的一样。
五:关数4测试
关数4的代码测试除了有关关数3的代码测试后,还增加了对船代码的测试,还有奖励的测试。
(1)对船的测试代码如下: //船的初始位置 function firstBoat1() { }
function firstBoat2() { }
function firstBoat3() { }
function firstBoat4() { }
function firstBoat5() {
_root.boat4._x = 645; _root.boat4._y = 231; _root.boat3._x = -900; _root.boat3._y = 231; _root.boat2._x = -450; _root.boat2._y = 231; _root.boat1._x = -43.2; _root.boat1._y = 231;
}
_root.boat5._x = 1000; _root.boat5._y = 231;
(2)船被击中的代码如下:
//检测弓箭与船集碰撞
if (_root.tan._currentframe == 10) {
hitboat1 = _root.tan.hitTest(_root.boat1); if (hitboat1) {
//myDieboat1Sound = new Sound();
//myDieboat1Sound.loadSound(\_root.boat1._x = 600; _root.score += 2; //船集中箭之后被打沉 with (_root.dieboat) { }
_x = _root.tan._x; _y = _root.tan._y; gotoAndPlay(2);
}
}
if (_root.tan._currentframe == 10) {
hitboat2 = _root.tan.hitTest(_root.boat2); if (hitboat2) {
//myDieboat1Sound = new Sound();
//myDieboat1Sound.loadSound(\_root.boat2._x = 600; _root.score += 2; //船集中箭之后被打沉 with (_root.dieboat) {
_x = _root.tan._x;
相关推荐: