Frame 1
lesbits = this.getBytesLoaded();
total = this.getBytesTotal();
pc = int((lesbits / total) * 100) + "%";
if (lesbits == total) {
_root.gotoAndPlay(3);
}
Stage.showMenu = false;
Frame 2
gotoAndPlay (1);
Frame 3
Mouse.show();
stop();
Frame 4
Mouse.hide();
function initGame() {
nextBalloonTime = 0;
nextBalloon = 0;
balloons = [];
numBalloons = 500;
ammo = 50;
nextBulletTime = 0;
nextBullet = 0;
bullets = [];
score = 0;
level = 1;
ducks = 0;
}
function newBalloon() {
if (nextBalloon < numBalloons) {
if (nextBalloonTime < getTimer()) {
if (Math.random() < 0.5) {
attachMovie("balloon", "balloon" + nextBalloon, nextBalloon);
ballon = _root["balloon" + nextBalloon];
if (Math.random() >= 0.5) {
_root["balloon" + nextBalloon]._x = 580;
if (level != 1) {
if (level != 2) {
if (level == 3) {
dx = -8;
}
} else {
dx = -6;
}
} else {
dx = -4;
}
ballon._xscale = Math.abs(ballon._xscale) * -1;
} else {
_root["balloon" + nextBalloon]._x = -30;
if (level != 1) {
if (level != 2) {
if (level == 3) {
dx = 8;
_root.back.gotoandstop(3);
}
} else {
dx = 6;
_root.back.gotoandstop(2);
}
} else {
dx = 4;
_root.back.gotoandstop(1);
}
ballon._xscale = Math.abs(ballon._xscale);
}
_root["balloon" + nextBalloon]._y = int(Math.random() * 100) + 47;
balloons.push({clip:"balloon" + nextBalloon, d:dx});
nextBalloon++;
nextBalloonTime = getTimer() + 2000;
}
}
}
}
function aimStraw() {
dx = _xmouse - straw._x;
dy = _ymouse - straw._y;
strawRadians = Math.atan2(dy, dx);
strawDegrees = (360 * strawRadians) / 6.283185;
straw._rotation = strawDegrees;
}
function moveBalloons() {
i = balloons.length - 1;
while (i >= 0) {
dx = balloons[i].d;
balloon = _root[balloons[i].clip];
balloon._x = balloon._x + dx;
if ((dx < 0) && (balloon._x < -20)) {
balloon.removemovieclip();
numBalloons--;
balloons.splice(i, 1);
} else if ((0 < dx) && (570 < balloon._x)) {
balloon.removemovieclip();
numBalloons--;
balloons.splice(i, 1);
}
i--;
}
if ((nextBalloon >= numBalloons) && (balloons.length < 1)) {
gotoAndStop (5);
}
}
function shootBullet() {
if (nextBulletTime < getTimer()) {
attachMovie("bullet", "bullet" + nextBullet, nextBullet + 9999);
bullet = _root["bullet" + nextBullet];
_root.son.gotoandplay(2);
bullet._x = straw._x + (Math.cos(strawRadians) * 20);
bullet._y = straw._y + (Math.sin(strawRadians) * 20);
bullets.push({clip:bullet, angle:strawRadians, down:0});
nextBullet++;
nextBulletTime = getTimer() + 1000;
}
}
function moveBullets() {
i = bullets.length - 1;
while (i >= 0) {
bullet = bullets[i].clip;
bullet._x = bullet._x + (Math.cos(bullets[i].angle) * 20);
bullet._y = bullet._y + (Math.sin(bullets[i].angle) * 20);
bullet._y = bullet._y + bullets[i].down;
bullets[i].down = bullets[i].down + 0.5;
if (400 < bullet._y) {
bullet.removemovieclip();
bullets.splice(i, 1);
ammo--;
if (ammo < 1) {
gotoAndStop (5);
}
} else if (bullet._y < 5) {
bullet.removemovieclip();
numBalloons--;
bullets.splice(i, 1);
ammo--;
} else {
if (checkCollision(bullet)) {
bullet.removemovieclip();
numBalloons--;
bullets.splice(i, 1);
ammo--;
}
if (ammo < 1) {
gotoAndStop (5);
}
}
i--;
}
}
function checkCollision(bullet) {
j = balloons.length - 1;
while (j >= 0) {
balloon = _root[balloons[j].clip];
if (distance(bullet, balloon) < 15) {
balloon.gotoandplay(2);
balloons.splice(j, 1);
if (level != 1) {
if (level != 2) {
if (level == 3) {
score = score + 25;
}
} else {
score = score + 15;
}
} else {
score = score + 10;
}
ducks++;
if (score != 200) {
if (score != 500) {
if (score == 1000) {
_root.gotoandstop("end");
}
} else {
level = 3;
ammo = 50;
_root.nextlevel.gotoandplay(2);
_root.nextlevel.nextLev.niv = 3;
}
} else {
level = 2;
ammo = 50;
_root.nextlevel.gotoandplay(2);
_root.nextlevel.nextLev.niv = 2;
}
return(true);
}
j--;
}
return(false);
}
function distance(clip1, clip2) {
dx = clip1._x - clip2._x;
dy = clip1._y - clip2._y;
return(Math.sqrt((dx * dx) + (dy * dy)));
}
function removeAll() {
i = 1;
while (i < 100) {
bullet = _root["bullet" + i];
bullet.removemovieclip();
balloon = _root["balloon" + i];
balloon.removemovieclip();
_root.fox.removemovieclip();
i++;
}
}
stop();
Instance of Symbol 59 MovieClip "fox" in Frame 4
onClipEvent (load) {
_root.initGame();
_root.crosshair.swapDepths(20000);
_root.fox.swapDepths(19000);
}
onClipEvent (enterFrame) {
_root.newBalloon();
_root.moveBalloons();
_root.aimStraw();
_root.moveBullets();
_root.crosshair._x = _xmouse;
_root.crosshair._y = _ymouse;
}
Frame 5
stop();
Mouse.show();
_root.crosshair.removeMovieClip();
removeAll();
stop();
Frame 6
stop();
removeAll();
_root.crosshair.removeMovieClip();
Mouse.show();
Symbol 1 MovieClip [balloon] Frame 1
stop();
Symbol 1 MovieClip [balloon] Frame 35
this.removeMovieClip();
stop();
Symbol 22 MovieClip Frame 1
if (this.sessionstarted != 1) {
this.arcade = new LoadVars();
this.sessionvars = new LoadVars();
this.arcade.gamename = "ducktracker";
this.arcade.sessdo = "sessionstart";
this.arcade.sendAndLoad("arcade.php", sessionvars, "POST");
if (this.sessionvars.sessiontype != 2) {
_root.is_a_challenge = 0;
} else {
_root.is_a_challenge = 1;
}
this.sessionstarted = 1;
}
if (_root.gameover == 1) {
if ((this.askpermission != 1) && (this.sessionvars.connStatus == 1)) {
this.prequestvars = new LoadVars();
this.pranswer = new LoadVars();
this.prequestvars.gametime = this.sessionvars.gametime;
this.prequestvars.fakekey = this.sessionvars.initbar;
_root.score = int(Number(_root.score));
if (_root.score != 0) {
this.prequestvars.score = _root.score;
} else {
this.prequestvars.score = -1;
}
this.prequestvars.id = this.sessionvars.lastid;
this.prequestvars.sessdo = "permrequest";
this.prequestvars.note = (this.prequestvars.id * this.prequestvars.score) * this.prequestvars.fakekey;
this.prequestvars.sendAndLoad("./arcade.php", this.pranswer, "POST");
this.askpermission = 1;
}
if ((this.pranswer.validate == 1) && (this.finalsent != 1)) {
this.burnscore = new LoadVars();
this.burnscore.microone = this.pranswer.microone;
this.burnscore.gametime = this.prequestvars.gametime;
this.burnscore.id = this.prequestvars.id;
if (_root.score == 0) {
this.burnscore.noscore = 1;
}
this.burnscore.sessdo = "burn";
this.burnscore.send("./arcade.php", "_self", "POST");
this.finalsent = 1;
}
}
Symbol 25 Button
on (release) {
gotoAndPlay (4);
}
Symbol 39 MovieClip Frame 1
stop();
Symbol 44 MovieClip Frame 1
stop();
Symbol 44 MovieClip Frame 2
stop();
Symbol 44 MovieClip Frame 3
stop();
Symbol 53 Button
on (release) {
gotoAndPlay (4);
}
Symbol 56 MovieClip Frame 1
stop();
Symbol 62 Button
on (keyPress "<Space>") {
_root.shootBullet();
}
Symbol 85 MovieClip Frame 1
stop();
Symbol 98 Button
on (keyPress "<Space>") {
_root.shootBullet();
}
Symbol 104 Button
on (release) {
_root.score = score;
_root.gameover = 1;
}
Symbol 113 Button
on (release) {
_root.score = score;
_root.gameover = 1;
}