Frame 1
function updateStats() {
var _local3 = Math.round((_global.hits / (_global.hits + _global.misses)) * 100);
var _local2 = Math.round((_global.hits / _global.shots) * 100);
if (isNaN(_local3)) {
_local3 = 0;
}
if (isNaN(_local2)) {
_local2 = 0;
}
stats_txt.text = ((((((((((((((((("shots:" + _global.shots) + "\t") + "hits: ") + _global.hits) + "\t") + "misses: ") + _global.misses) + "\t") + "targets hit: ") + _local3) + "%") + "\t") + "accuracy: ") + _local2) + "%") + "\t") + "level:") + _global.level;
}
function randRange(minNum, maxNum) {
return(Math.floor(Math.random() * ((maxNum - minNum) + 1)) + minNum);
}
_global.hits = 0;
_global.misses = 0;
_global.shots = 0;
_global.cDepth = 100;
_global.level = 1;
var xSpeed = 3;
var stageWidth = 550;
var stageHeight = 580;
this.attachMovie("crosshair_mc", "crosshair_mc", 5001);
Mouse.hide();
var mouseListener = new Object();
mouseListener.onMouseMove = function () {
crosshair_mc._x = _xmouse;
crosshair_mc._y = _ymouse;
};
mouseListener.onMouseDown = function () {
if (bg_mc.hitTest(_xmouse, _ymouse, false)) {
_global.shots++;
}
};
Mouse.addListener(mouseListener);
var my_fmt = new TextFormat();
my_fmt.bold = true;
my_fmt.font = "Arial";
my_fmt.size = 12;
my_fmt.color = 16777215 /* 0xFFFFFF */;
this.createTextField("stats_txt", 5000, 70, 18, 530, 22);
stats_txt.setNewTextFormat(my_fmt);
stats_txt.selectable = false;
stats_txt.tabStops = [100, 200, 300, 400];
updateStats();
this.onEnterFrame = function () {
if (randRange(0, 20) == 0) {
var _local5 = randRange(1, 3);
var _local3 = this.attachMovie(("tofu" + _local5) + "_mc", ("target" + _global.cDepth) + "_mc", _global.cDepth);
_global.cDepth++;
_local3._x = -_local3._width;
var _local4 = randRange(80, 100);
_local3._xscale = _local4;
_local3._yscale = _local4;
_local3._alpha = _local4;
_local3.speed = (xSpeed + randRange(0, 3)) + _global.level;
_local3._y = Math.round(Math.random() * 350) + 65;
_local3.onEnterFrame = function () {
this._x = this._x + this.speed;
this._y = this._y - 0.4;
if (this._x > stageWidth) {
_global.misses++;
updateStats();
this.removeMovieClip();
}
};
_local3.onPress = function () {
_global.hits++;
if ((_global.hits % 40) == 0) {
_global.level++;
}
updateStats();
this.gotoAndPlay("hit");
var ymov = this._y;
var gravity = 20;
this.onEnterFrame = function () {
ymov = ymov + gravity;
xmov = xmov * 0.5;
this._rotation = this._rotation + 5;
this._x = this._x + xSpeed;
this._y = ymov;
if (this._y > stageHeight) {
this.removeMovieClip();
}
};
delete this.onPress;
};
}
};
Symbol 4 MovieClip [tofu1_mc] Frame 1
stop();
Symbol 4 MovieClip [tofu1_mc] Frame 30
stop();
Symbol 5 MovieClip [target_mc] Frame 1
stop();
Symbol 5 MovieClip [target_mc] Frame 29
stop();
Symbol 10 MovieClip [tofu2_mc] Frame 1
stop();
Symbol 10 MovieClip [tofu2_mc] Frame 30
stop();
Symbol 17 MovieClip [tofu3_mc] Frame 1
stop();
Symbol 17 MovieClip [tofu3_mc] Frame 30
stop();