VVV
08-17-2004, 01:42 PM
Hello everybody. This is my game a birthday gift for my friend, in which the aircraft replaces the mouse, drops off the bomb when you click, once the bomb touch the tank , tank explodes.
Now the game is uncompleted. I `ve got troubles in the part of Action Script. The bomb falls successfully. But only one tank can be bombed and explodes, whose instance name is "tank" . When the bomb touchs other tanks ( "tank2" "tank3"....... ), these tanks don`t work . How to make a Action Script that can bomb every tank ?
I show my work below:
There are 5 tank in total. Their instance name is "tank" "tank2" "tank3" "tank4" "tank5" . Beside, I made 5 movie clips which are the exploding animation. (Instance name --"tank_explode" ,"tank2_explode",.... "tank5_explode") They are different for each other . when the bomb ("bomb") form the aircraft("aircraft") touch tank, the "tank_expolde" will replace the "tank", so is to others.
this is the AS which I put in the 1st frame of movie clip "bomb"
this.onEnterFrame = function() {
// trace(this.hitTest(_root.
if (this.hitTest(_root.tank)) {
flag = 1;
tellTarget (_root.tank) {
gotoAndPlay(2);
}
removeMovieClip(this);
}
};
AS in the last frame
removeMovieClip(this);
This is the AS I put in the Frame Action of MC"aircaft"
Mouse.hide();
bomb._visible = false;
i = 0;
startDrag("aircraft", true);
// function checker(){
// for(j=1;j<=i;j++){
// //trace(_root["bomb"+i].hitTest(_root.tank));
// if (_root["bomb"+i].flag == 1){
// tank.gotoAndStop(2);
// }
// }
// }
//
_root.onMouseDown = function() {
duplicateMovieClip(bomb, "bomb"+i, i);
_root["bomb"+i]._x = _xmouse;
_root["bomb"+i]._y = _ymouse;
// _root["bomb"+i].gotoAndPlay("play");
// tellTarget(eval("bomb"+i)){
// gotoAndPlay(11);
// }
++i;
};
// setInterval(checker,100);
Please show me the correct Action Script and step . Thanks very much ! ! !
Now the game is uncompleted. I `ve got troubles in the part of Action Script. The bomb falls successfully. But only one tank can be bombed and explodes, whose instance name is "tank" . When the bomb touchs other tanks ( "tank2" "tank3"....... ), these tanks don`t work . How to make a Action Script that can bomb every tank ?
I show my work below:
There are 5 tank in total. Their instance name is "tank" "tank2" "tank3" "tank4" "tank5" . Beside, I made 5 movie clips which are the exploding animation. (Instance name --"tank_explode" ,"tank2_explode",.... "tank5_explode") They are different for each other . when the bomb ("bomb") form the aircraft("aircraft") touch tank, the "tank_expolde" will replace the "tank", so is to others.
this is the AS which I put in the 1st frame of movie clip "bomb"
this.onEnterFrame = function() {
// trace(this.hitTest(_root.
if (this.hitTest(_root.tank)) {
flag = 1;
tellTarget (_root.tank) {
gotoAndPlay(2);
}
removeMovieClip(this);
}
};
AS in the last frame
removeMovieClip(this);
This is the AS I put in the Frame Action of MC"aircaft"
Mouse.hide();
bomb._visible = false;
i = 0;
startDrag("aircraft", true);
// function checker(){
// for(j=1;j<=i;j++){
// //trace(_root["bomb"+i].hitTest(_root.tank));
// if (_root["bomb"+i].flag == 1){
// tank.gotoAndStop(2);
// }
// }
// }
//
_root.onMouseDown = function() {
duplicateMovieClip(bomb, "bomb"+i, i);
_root["bomb"+i]._x = _xmouse;
_root["bomb"+i]._y = _ymouse;
// _root["bomb"+i].gotoAndPlay("play");
// tellTarget(eval("bomb"+i)){
// gotoAndPlay(11);
// }
++i;
};
// setInterval(checker,100);
Please show me the correct Action Script and step . Thanks very much ! ! !