Screw it, I'll give you this one.
myscore =0
miss =3
var i;
var miss;
// gunfire sounds
var gunfire = new Sound();
gunfire.attachSound("gunfire");
_root.hit1.onPress = function() {
gunfire.start();
i++;
// make bullet holes
_root.bull.duplicateMovieClip("bulletNew" + i, i);
if (i == 10) {
i = 0;
}
// hit test on target
if (_root.target_mc.hitTest(_root._xmouse, _root._ymouse, false)) {
// play explosion
myscore +=1
// send target off stage
_root.target_mc._x = 0;
_root.target_mc._y = random(300);
}
};
// initialise stuff
_root.onLoad = function() {
// hide the mouse
Mouse.hide();
};
//loop
_root.onEnterFrame = function() {
//put cross hairs to mouse coords
_root.gun._x = _root._xmouse;
_root.gun._y = _root._ymouse;
// target move
_root.target_mc._x += 10;
// if it goes offstage, send it stage left
if (_root.target_mc._x<0 || _root.target_mc._x>Stage.width) {
_root.target_mc._x = 0;
_root.target_mc._y = random(300);
}
if (_root.target_mc.hitTest(edge)) {
miss-=1;
_root.target_mc._x = 0;
_root.target_mc._y = random(300);
}
//set the next level score thing
if (Number(_root.myscore) == 2) {
gotoAndStop (8);
}
if (Number(_root.miss) ==0) {
gotoAndStop (10);
}
};
//set scores and lives
myscore == 0;
miss == 3;
This is on the main timeline.
Name the target "target_mc"
Name the aiming thing "gun"
Export for linkeage your gunfire sound, with the linkeage name "gunfire"
Cover the stage with a button with the instance name "hit1"
I think that's it. Try it and see...