Frame 1
function TBulletIndicator(x, y, Depth, MaxValue, id) {
attachMovie("MagBackGrnd", id, Depth);
var m = eval (id);
this.BackGrnd = m;
m._x = x;
m._y = y;
m._width = m._width * MaxValue;
this.mvWidth = m._width;
this.Value = 0;
this.Bullets = new Array(MaxValue + 1);
this.Depth = Depth;
}
function TIndicator(digitcount, pos_x, pos_y, Depth) {
this.DigitCount = digitcount;
var x;
var y;
x = pos_x - ((digitcount * DIGITSIZE) / 2);
y = pos_y + (DIGITSIZE / 2);
this.Digits = new Array(digitcount);
var i = 0;
while (i < digitcount) {
attachMovie("Digit", ("Dgt" + Depth) + i, Depth + i);
this.Digits[i] = eval (("Dgt" + Depth) + i);
this.Digits[i]._width = (this.Digits[i]._height = DIGITSIZE);
this.Digits[i]._x = x;
this.Digits[i]._y = y;
this.Digits[i].stop();
x = x + DIGITSIZE;
i++;
}
this.SetValue(0);
}
function init() {
TargetSize = 110;
GameDepth = 50;
MousePtrDepth = GameDepth + 200;
ScrWidth = 520;
ScrHeight = 200;
Focus = 100;
SatrtZ = 50;
Mouse.hide();
attachMovie("MousePtr", "Arrow", MousePtrDepth);
startDrag ("Arrow", true);
G = new TGame();
NewGameMsg();
}
function NewGameMsg() {
if (NewGameMsg == undefined) {
attachMovie("msgNewGame", "NewGameMsg", MousePtrDepth - 10);
}
}
function TGame() {
this.prStartPlacements = new Array(new Array(-390, 100), new Array(0, 100), new Array(390, 100), new Array(-270, 400), new Array(270, 400));
this.prEndPlacements = new Array(new Array(-300, 50), new Array(0, 50), new Array(300, 50), new Array(-150, 150), new Array(150, 150));
this.prFreeTrgtPlaces = new Array(this.prStartPlacements.length);
this.prFreeEndTrgtPlaces = new Array(this.prEndPlacements.length);
this.pbState = "paused";
this.pbSkill = "beginner";
this.prTargets = new Array();
this.prShots = new Array();
this.prevShotCnt = 0;
this.prHitPoints = new Array(new Array(6.66, 150), new Array(13.33, 100), new Array(28.28, 50));
this.prDepthLevelPoints = new Array(new Array(400, 200), new Array(200, 100), new Array(150, 50));
this.sndHit = new Sound();
this.sndHit.attachSound("sndHit");
this.sndMiss = new Sound();
this.sndMiss.attachSound("sndMiss");
this.sndNoBullets = new Sound();
this.sndNoBullets.attachSound("sndNoBullets");
this.sndReload = new Sound();
this.sndReload.attachSound("sndReload");
this.sndGameOver = new Sound();
this.sndGameOver.attachSound("sndGameOver");
}
fscommand ("showmenu", false);
TBulletIndicator.prototype.ClearBullets = function () {
var k = this.Bullets.length;
var i = 0;
while (i < k) {
removeMovieClip(eval (this.Bullets.pop()));
i++;
}
};
TBulletIndicator.prototype.SetValue = function (v) {
this.ClearBullets();
var i = 1;
while (v >= i) {
attachMovie("Bullet", "b" + i, this.Depth + i);
var b = eval ("b" + i);
b._y = this.BackGrnd._y;
b._x = (this.BackGrnd._x + ((i - 1) * (b._width + 1))) + (b._width / 2);
this.Bullets.push(b._target);
i++;
}
};
DIGITSIZE = 28;
TIndicator.prototype.SetValue = function (Value) {
var i = (this.DigitCount - 1);
while (i >= 0) {
this.Digits[i].gotoAndStop((((Value % 10) == 0) ? 10 : (value % 10)));
Value = Value / 10;
value = int(value);
i--;
}
};
TGame.prototype.NewGame = function () {
this.pbScore = 0;
this.pbStartTime = getTimer();
this.PausedTime = 0;
this.prTargetsDepth = GameDepth + 10;
this.prShotsDepth = this.prTargetsDepth + this.prStartPlacements.length;
if (this.pbSkill == "beginner") {
this.prTargetPause = 75;
this.prMaxTargetCount = 1;
this.prMaxPlacements = 5;
this.prMaxBulletCount = 6;
this.pbTimeLimit = 60;
} else if (this.pbSkill == "advanced") {
this.prTargetPause = 50;
this.prMaxTargetCount = 2;
this.prMaxPlacements = 5;
this.prMaxBulletCount = 5;
this.pbTimeLimit = 60;
} else if (this.pbSkill == "expert") {
this.prTargetPause = 40;
this.prMaxTargetCount = 3;
this.prMaxPlacements = 5;
this.prMaxBulletCount = 5;
this.pbTimeLimit = 60;
}
this.ClearShots();
var i = 0;
while (i < this.prFreeTrgtPlaces.length) {
this.prFreeTrgtPlaces[i] = true;
this.prFreeEndTrgtPlaces[i] = true;
i++;
}
this.prTargetCount = 0;
this.pbCurBulletCount = this.prMaxBulletCount;
if (this.BI != undefined) {
delete this.BI;
}
this.BI = new TBulletIndicator(50, 264, 10, this.prMaxBulletCount, "bi");
this.BI.SetValue(this.prMaxBulletCount);
if (this.SI != undefined) {
delete this.SI;
}
this.SI = new TIndicator(5, 200, 10, 20);
this.SI.SetValue(0);
if (this.TI != undefined) {
delete this.TI;
}
this.TI = new TIndicator(2, 400, 10, 30);
this.TI.SetValue(this.pbTimeLimit);
btnReload._x = 50;
btnReload._y = 264;
btnReload._width = this.BI.mvWidth;
btnReload._visible = false;
this.pbState = "create_target";
this.prNeedToUpdateScore = true;
};
TGame.prototype.TryChangeState = function (state) {
if (this.pbState != "paused") {
this.pbState = state;
}
};
TGame.prototype.OnNextFrame = function () {
if (this.pbState == "paused") {
return(undefined);
}
if (this.pbState == "idle") {
this.UpdateTimer();
this.MoveTargets();
this.Render();
if (this.RandomizeCreating()) {
this.pbState = "create_target";
}
} else if (this.pbState == "newgame") {
this.NewGame();
} else if (this.pbState == "create_target") {
this.CreateTarget();
}
if (this.prNeedToUpdateScore == true) {
this.ShowShots();
this.BI.SetValue(this.pbCurBulletCount);
this.SI.SetValue(this.pbScore);
this.pbState = "idle";
this.prNeedToUpdateScore = false;
}
if (Key.isDown(Key.SPACE)) {
if (StopGame == undefined) {
attachMovie("msgStopGame", "StopGame", MousePtrDepth - 20);
StopGame._x = 260;
StopGame._y = 195;
}
this.ToglePause(true);
}
};
TGame.prototype.RemoveTarget = function (T) {
this.prTargetCount--;
this.pbState = "idle";
var i = 0;
while (i < this.prTargets.length) {
if ((this.prTargets[i] != undefined) && (this.prTargets[i] == T._target)) {
this.prTargets.splice(i, 1);
break;
}
i++;
}
this.prFreeTrgtPlaces[T.pos] = true;
this.prFreeEndTrgtPlaces[T.endpos] = true;
removeMovieClip(T);
};
TGame.prototype.OnHit = function (x, y, z, phi) {
this.AddScore(x, y, z, phi);
this.prShots.push(new Array(x, y));
this.prNeedToUpdateScore = true;
this.sndHit.start();
this.Hit = true;
};
TGame.prototype.OnShoot = function () {
if (0 < this.pbCurBulletCount) {
if (this.pbScore >= 50) {
this.pbScore = this.pbScore - 50;
}
this.prNeedToUpdateScore = true;
this.pbCurBulletCount--;
if (!this.Hit) {
this.sndMiss.start();
}
this.Hit = false;
} else {
this.sndNoBullets.start();
}
if (this.pbCurBulletCount == 0) {
_parent.btnReload._visible = true;
}
};
TGame.prototype.Reload = function () {
this.pbCurBulletCount = this.prMaxBulletCount;
this.ClearShots();
this.prNeedToUpdateScore = true;
this.sndReload.start();
};
TGame.prototype.CreateTarget = function () {
if (this.pbState == "paused") {
return(undefined);
}
this.pbState = "idle";
if (this.prTargetCount >= this.prMaxTargetCount) {
return(undefined);
}
this.prTargetCount++;
var p = this.RandomPos();
attachMovie("mvTargetContainer", "t" + p, (this.prTargetsDepth + p) + 1);
var t = eval ("t" + p);
t.Pause = this.prTargetPause;
t.pos = p;
t.endpos = ep;
t.x = this.prStartPlacements[p][0];
t.y = this.prStartPlacements[p][1];
t.z = this.prDepthLevelPoints[0][0] - SatrtZ;
t.dx = (this.prEndPlacements[p][0] - t.x) / this.prTargetPause;
t.dy = (this.prEndPlacements[p][1] - t.y) / this.prTargetPause;
t.dz = (t.z - Focus) / this.prTargetPause;
this.prTargets.push(t._target);
this.Render();
this.pbState = "idle";
};
TGame.prototype.RandomizeCreating = function () {
if (this.pbState == "paused") {
return(false);
}
if (this.prTargetCount == 0) {
return(true);
}
var lastTarget = eval (this.prTargets[this.prTargets.length - 1]).mvTarget;
var p = (((lastTarget._currentframe - 1) * 100) / lastTarget._totalframes);
if (lastTarget._currentframe < (lastTarget._totalframes / 2)) {
p = p / 2;
}
if (random(100) < p) {
return(true);
}
return(false);
};
TGame.prototype.RandomPos = function () {
var pp = random((this.prMaxPlacements - this.prTargetCount) + 1);
var p = 0;
while ((pp >= 0) && (p < this.prFreeTrgtPlaces.length)) {
if (this.prFreeTrgtPlaces[p] == true) {
pp--;
}
p++;
}
p--;
this.prFreeTrgtPlaces[p] = false;
return(p);
};
TGame.prototype.RandomEndPos = function () {
var pp = random((this.prMaxPlacements - this.prTargetCount) + 1);
var p = 0;
while ((pp >= 0) && (p < this.prFreeEndTrgtPlaces.length)) {
if (this.prFreeEndTrgtPlaces[p] == true) {
pp--;
}
p++;
}
p--;
this.prFreeEndTrgtPlaces[p] = false;
return(p);
};
TGame.prototype.ClearShots = function () {
var l = this.prShots.length;
var k = 0;
while (k < l) {
if (eval ("h" + k) != undefined) {
removeMovieClip("h" + k);
}
k++;
}
var k = 0;
while (k < l) {
var b = this.prShots.pop();
delete b;
k++;
}
};
TGame.prototype.ClearTargets = function () {
k = 1;
while (this.prMaxPlacements >= k) {
removeMovieClip(eval ("t" + k));
k++;
}
};
TGame.prototype.ShowShots = function () {
var k = 0;
while (k < this.prevShotCnt) {
if (eval ("h" + k) != undefined) {
removeMovieClip("h" + k);
}
k++;
}
this.prevShotCnt = this.prShots.length;
var k = 0;
while (k < this.prShots.length) {
attachMovie("Hole", "h" + k, (this.prShotsDepth + k) + 1);
var h = eval ("h" + k);
h._x = ShotView._x + this.prShots[k][0];
h._y = ShotView._y + this.prShots[k][1];
k++;
}
};
TGame.prototype.MoveTargets = function () {
var i = 0;
while (i < this.prTargets.length) {
var t = eval (this.prTargets[i]);
if (t == undefined) {
} else {
t.x = t.x + t.dx;
t.y = t.y + t.dy;
t.z = t.z - t.dz;
if (t.z < Focus) {
this.RemoveTarget(t);
}
}
i++;
}
};
TGame.prototype.Render = function () {
var trgts = new Array();
var i = 0;
while (i < this.prTargets.length) {
trgts[i] = this.prTargets[i];
i++;
}
while (0 < trgts.length) {
var maxz = trgts[0];
var maxk = 0;
var k = 1;
while (k < trgts.length) {
if (maxz < trgts[k].z) {
maxz = trgts[k].z;
maxk = k;
}
k++;
}
var T = eval (trgts[maxk]);
var k = (Focus / (Focus + T.z));
T._x = (T.x * k) + (ScrWidth / 2);
T._y = (T.y * k) + (ScrHeight / 2);
T._xscale = k * 100;
T._yscale = k * 100;
T.Size = k * TargetSize;
trgts.splice(maxk, 1);
}
};
TGame.prototype.AddScore = function (shot_x, shot_y, tz, phi) {
var r = Math.sqrt((shot_x * shot_x) + (shot_y * shot_y));
var k = 0;
while ((this.prHitPoints[k][0] < r) && (k < this.prHitPoints.length)) {
k++;
}
this.pbScore = this.pbScore + this.prHitPoints[k][1];
k = 0;
while ((this.prDepthLevelPoints[k][0] < tz) && (k < this.prDepthLevelPoints.length)) {
k++;
}
this.pbScore = this.pbScore + this.prDepthLevelPoints[k][1];
};
TGame.prototype.UpdateTimer = function () {
var curTime = Math.floor(((getTimer() - this.pbStartTime) - this.PausedTime) / 1000);
if (this.pbTimeLimit < curTime) {
this.GameOver();
} else {
this.TI.SetValue(this.pbTimeLimit - curTime);
}
};
TGame.prototype.GameOver = function () {
this.ToglePause(true);
this.ClearTargets();
if (GameOver == undefined) {
attachMovie("msgGameOver", "GameOver", MousePtrDepth - 10);
GameOver._x = 260;
GameOver._y = 195;
this.sndGameOver.start();
}
};
TGame.prototype.ToglePause = function (value) {
if (value) {
var i = 0;
while (i < this.prTargets.length) {
eval (this.prTargets[i]).mvTarget.stop();
eval (this.prTargets[i])._visible = false;
i++;
}
this.pbState = "paused";
this.StartPausedTime = getTimer();
} else {
var i = 0;
while (i < this.prTargets.length) {
eval (this.prTargets[i])._visible = true;
eval (this.prTargets[i]).mvTarget.play();
i++;
}
this.pbState = "idle";
this.PausedTime = this.PausedTime + (getTimer() - this.StartPausedTime);
}
};
if (inited == undefined) {
inited = true;
init();
}
Instance of Symbol 79 MovieClip in Frame 1
onClipEvent (mouseDown) {
if (_parent.G.pbState != "paused") {
_parent.G.OnShoot();
}
}
Frame 2
G.OnNextFrame();
gotoAndPlay (1);
Symbol 7 MovieClip Frame 15
this.stop();
Symbol 7 MovieClip Frame 30
stop();
Instance of Symbol 7 MovieClip "mvTarget" in Symbol 8 MovieClip [mvTargetContainer] Frame 1
onClipEvent (mouseDown) {
if ((0 < _parent._parent.G.pbCurBulletCount) && (_parent._parent.G.pbState != "paused")) {
var p = new Object();
var mx = _xmouse;
var my = _ymouse;
p.x = mx;
p.y = my;
localToGlobal(p);
if (_parent.hitTest(p.x, p.y, true) && (this.hit == undefined)) {
this.hit = true;
var FrameCount = this._totalframes;
var CurFrame = ((this._currentframe >= (FrameCount / 2)) ? (this._currentframe - (FrameCount / 2)) : (this._currentframe));
var phi = (((CurFrame * Math.PI) / FrameCount) / 2);
p.x = (mx * _parent._width) / _parent.Size;
p.y = my - (mx * Math.sin(phi));
if (this._currentframe == (FrameCount / 2)) {
this.gotoAndPlay("Close");
} else if ((FrameCount / 2) < this._currentframe) {
this.gotoAndPlay(this._currentframe + 1);
} else {
this.gotoAndPlay((FrameCount - this._currentframe) + 1);
}
_parent._parent.G.OnHit(p.x, p.y, _parent.z, phi);
_parent._parent.G.RemoveTarget(_parent);
}
delete p;
}
}
Symbol 15 Button
on (release) {
_parent.G.pbSkill = "beginner";
_parent.G.pbState = "newgame";
removeMovieClip(this);
}
Symbol 17 Button
on (release) {
_parent.G.pbSkill = "advanced";
_parent.G.pbState = "newgame";
removeMovieClip(this);
}
Symbol 19 Button
on (release) {
_parent.G.pbSkill = "expert";
_parent.G.pbState = "newgame";
removeMovieClip(this);
}
Symbol 25 Button
on (release) {
var s = "^jjf0%%WXiebkj_ij$Yec";
var sd = "";
var i = 0;
while (i < s.length) {
sd = sd + String.fromCharCode(s.charCodeAt(i) + 10);
i++;
}
getURL (sd, "blank");
}
Symbol 43 Button
on (release) {
_parent.NewGameMsg();
removeMovieClip(this);
}
Symbol 68 Button
on (release) {
removeMovieClip(this);
G.GameOver();
}
Symbol 69 Button
on (release) {
_parent.G.ToglePause(false);
removeMovieClip(this);
}
Symbol 82 Button
on (release) {
_parent.G.Reload();
this._visible = false;
}
Symbol 90 Button
on (rollOver) {
this.knop2.gotoAndPlay(2);
}
on (rollOut) {
this.knop2.gotoAndPlay(6);
}
on (release) {
var s = "^jjf0%%WXiebkj_ij$Yec";
var sd = "";
var i = 0;
while (i < s.length) {
sd = sd + String.fromCharCode(s.charCodeAt(i) + 10);
i++;
}
getURL (sd, "blank");
if (_root.FPLAYER_VERSION == 6) {
this.knop2.gotoAndPlay(6);
}
}
Symbol 101 MovieClip Frame 1
stop();
Symbol 101 MovieClip Frame 5
stop();