My movie for some reason is not working out. All it does is flash on and off and nothing works. It is a first person shooter. Following is my code:
// gunfire sounds
var gunfire = new Sound();
gunfire.attachSound(“gunfire”);
_root.hit1.onPress = function() {
gunfire.svar i;
tart();
i++;
// make bullet holes
_root.bull.duplicateMovieClip(“bulletNew”, i);
if (i == 10) {
i = 0;
}
// hit test on target
if (_root.target_mc.hitTest(_root._xmouse, _root._ymouse, false)) {
// play explosion
_root.gun.gotoAndPlay(2);
// send target off stage
_root.target_mc._x = 0;
_root.target_mc._y = random(400);
}
};
// 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(400);
}
};
my_btn.onRollOver = function() {
Mouse.show();
}
// hide mouse
my_btn.onRollOut = function() {
Mouse.hide();
}
on (rollOutgotoAndPlay(scene 2();
);
) {
}
on the movie clips for the gun sight and my_btn I have a stop action on frame 1 on the movie clip timeline.
Any help is appreciated.
Thank you