Frame 1
Stage.showMenu = false;
function reloadAnim() {
bow._rotation = bow._rotation * 0.7;
bow1._rotation = bow1._rotation * 0.35;
if (bow._rotation < 1) {
bow.gotoAndPlay("reload");
bow1.gotoAndPlay("reload");
bow._rotation = 0;
bow1._rotation = 0;
angle = 0;
clearInterval(reloadInterval);
}
}
function changeWind() {
if (random(5) == 0) {
var _local1 = random(3) - 1;
wind = wind + _local1;
if (wind > 4) {
wind = 4;
} else if (wind < -4) {
wind = -4;
}
updateWind();
}
}
function updateWind() {
windFlag.gotoAndStop(5 + wind);
windFlag2.gotoAndStop(5 + wind);
}
function displayScores() {
_root["name" + scoresTimer] = scores["name" + scoresTimer];
_root["score" + scoresTimer] = (scores["score" + scoresTimer] + " ") + scores[(("hit" + scoresTimer) + " ") + scores["miss" + scoresTimer]];
scoresTimer++;
if (scoresTimer > 5) {
clearInterval(scoresInterval);
}
}
function updateBow() {
if (controlStyle == "mouse") {
angle = Math.atan2(bow._y - _ymouse, bow._x - _xmouse) * 57.2957795130823;
if (angle > 60) {
angle = 60;
} else if (angle < 0) {
angle = 0;
}
}
bow._rotation = angle;
bow1._rotation = angle / 2;
head._rotation = angle / 3;
}
function removeBalloon(name, bool, shooter) {
var _local1 = _root;
var _local2 = name;
var _local3 = this;
i = 0;
while (i < Balloons.length) {
if (Balloons[i] == _local2) {
if (bool) {
if ((maxCounter > 30) && (gameType == "tournament")) {
maxCounter = maxCounter - 2;
}
_local1[shooter].balloonsPopped++;
_local1[Balloons[i]].tempScore = 0;
_local1[Balloons[i]].tempScore = 1 + Math.round((345 - _local1[Balloons[i]]._y) / 25);
if (_local1[shooter].balloonsPopped == 2) {
_local1[Balloons[i]].tempScore = _local1[Balloons[i]].tempScore * 5;
}
score = score + _local1[Balloons[i]].tempScore;
_local1.attachMovie("scoreDisplay", "scoreDisplay" + sdI, 200 + sdI);
_local1["scoreDisplay" + sdI]._x = _local1[_local2]._x;
if (_local1[_local2]._x < 20) {
_local1["scoreDisplay" + sdI]._x = 20;
}
_local1["scoreDisplay" + sdI]._y = _local1[_local2]._y;
if (_local1[_local2]._y < 0) {
_local1["scoreDisplay" + sdI]._y = 0;
}
_local1["scoreDisplay" + sdI].display = _local1[Balloons[i]].tempScore;
_local1["scoreDisplay" + sdI].riseRate = 0.5;
_local1["scoreDisplay" + sdI].onEnterFrame = function () {
var _local1 = this;
_local1._y = _local1._y - _local1.riseRate;
_local1._alpha = _local1._alpha - 2;
_local1.riseRate = _local1.riseRate * 1.1;
if (_local1._y < -30) {
_local1.removeMovieClip();
}
};
sdI++;
if (sdI > 10) {
sdI = 0;
}
delete _local1[_local2].onEnterFrame;
_local1[_local2].gotoAndPlay("pop");
balloonsPoppedTotal++;
var mySound = new Sound(bow);
if (_local1[shooter].balloonsPopped == 2) {
mySound.attachSound("croikey");
mySound.start(0, 1);
}
var myOtherSound = new Sound(bow1);
myOtherSound.attachSound("arrowSound");
myOtherSound.start(0, 1);
} else {
balloonsMissedTotal++;
_local1[_local2].removeMovieClip();
}
Balloons.splice(i, 1);
return;
}
i++;
}
}
function addBalloon(name) {
Balloons.push(name);
}
function spawnBalloon(barrelToSpawnIn) {
var _local2 = this;
var _local3 = _root;
var _local1 = "balloon" + balloonDepth;
_local3.attachMovie("balloon", _local1, balloonDepth);
_local3[_local1]._x = (barrelToSpawnIn * 63) - 17;
_local3[_local1]._y = 345;
_local3[_local1].rate = 1;
_local3[_local1].tempScore = 0;
_local3[_local1].namey = _local1;
addBalloon(_local1);
_local3[_local1].gotoAndStop(random(7) + 1);
_local3[_local1].onEnterFrame = function () {
var _local1 = this;
_local1._y = _local1._y - _local1.rate;
if (_local1._y < 280) {
_local1._x = _local1._x + (wind / 3);
}
if (_local1.rate < 5) {
_local1.rate = _local1.rate * 1.01;
}
if (_local1._y < -250) {
removeBalloon(_local1.namey, false);
}
};
balloonDepth++;
if (balloonDepth > 70) {
balloonDepth = 50;
}
}
function updatePower() {
powerBar.gotoAndStop(power);
bow.gotoAndStop(power);
bow1.gotoAndStop(power);
if (power == 0) {
powerBar.gotoAndStop(1);
}
}
function fire() {
var _local1 = this;
var _local2 = _root;
arrowsShotTotal++;
arrowsInMotion++;
reloading = true;
reloadInterval = setInterval(reloadAnim, 41);
boxY._x = -40;
var _local3 = "arrow" + aI;
_local2.attachMovie("arrow", "arrow" + aI, 10 + aI);
_local2.attachMovie("arrowShadow", "arrowShadow" + aI, 20 + aI);
_local2["arrowShadow" + aI]._y = 345;
_local2["arrowShadow" + aI]._x = bow._x;
_local2[_local3]._x = bow._x;
_local2[_local3]._y = bow._y;
_local2[_local3].name = _local3;
_local2[_local3].balloonsPopped = 0;
_local2[_local3].shadow = "arrowShadow" + aI;
_local2[_local3].Vx = Math.cos(Number(angle) * (Math.PI/180)) * power;
_local2[_local3].Vy = Math.sin(Number(angle) * (Math.PI/180)) * power;
aI++;
if (aI > 10) {
aI = 0;
}
_local2[_local3].onEnterFrame = function () {
var _local1 = this;
var _local2 = _root;
_local1._x = _local1._x - (Number(_local1.Vx) - wind);
_local2[_local1.shadow]._x = _local1._x;
_local1._y = _local1._y - Number(_local1.Vy);
_local1.Vy = _local1.Vy - 0.40875;
_local1.angle = Math.atan2(_local1.Vy, _local1.Vx) * 57.2957795130823;
_local1._rotation = _local1.angle;
if (trackHeight && ((_local1._y < 0) || (_local1._x < 0))) {
boxY._y = 0;
boxY.display = Math.round((bow._y - _local1._y) / 24) + 2;
if (_local1._x < 0) {
boxY._x = 0;
boxY._y = _local1._y;
if (_local1._y < 0) {
boxY._y = 0;
}
} else if (_local1._x > bow._x) {
boxY._x = bow._x - boxY._width;
} else {
boxY._x = _local1._x;
}
} else {
boxY._x = 0;
boxY._y = -100;
}
j = 0;
while (j < Balloons.length) {
trace((("checking " + _local1.name) + " with ") + Balloons[j]);
if (_local2[Balloons[j]].hitTest(_local1._x, _local1._y, true)) {
removeBalloon(Balloons[j], true, _local1.name);
}
j++;
}
if ((_local1._y > 345) || (_local1._x < -150)) {
arrowsInMotion--;
_local2.attachMovie("brokenArrow", "brokenArrow", 10 + aI);
brokenArrow._x = _local1._x;
brokenArrow._y = 345;
boxY._x = 0;
boxY._y = -100;
if ((gameType == "tournament") && (_local1.balloonsPopped == 0)) {
arrowsLeftContainer["arrowIcon" + arrowsLeft].gotoAndStop(2);
arrowsLeft--;
if (arrowsLeft == 0) {
gotoAndStop (4);
_local1._visible = false;
delete _local2.onEnterFrame;
}
}
_local1.balloonsPopped = 0;
delete _local1.balloonsPopped;
updateBow();
_local2[_local1.shadow].removeMovieClip();
_local1.removeMovieClip();
}
};
}
playerName = "Anonymous";
inGame = false;
mouseIsDown = false;
_root.onMouseDown = function () {
mouseIsDown = true;
};
_root.onMouseUp = function () {
mouseIsDown = false;
if (inGame && (controlStyle == "mouse")) {
if ((gameType == "tournament") && ((arrowsLeft - arrowsInMotion) <= 0)) {
power = 0;
updatePower();
} else if ((power > 0) && (!reloading)) {
fire();
bow.gotoAndStop("noArrow");
bow1.gotoAndStop("noArrow");
power = 0;
updatePower();
}
}
};
keyTrack = new Object();
keyTrack.onKeyUp = function () {
if (Key.getCode() == 32) {
if ((gameType == "tournament") && ((arrowsLeft - arrowsInMotion) <= 0)) {
power = 0;
updatePower();
} else if ((power > 0) && (!reloading)) {
fire();
bow.gotoAndStop("noArrow");
bow1.gotoAndStop("noArrow");
power = 0;
updatePower();
}
}
};
controlStyle = "keyboard";
trackHeight = false;
stop();
Instance of Symbol 46 MovieClip "loadBar" in Frame 1
onClipEvent (enterFrame) {
var loaded = ((_root.getBytesLoaded() / _root.getBytesTotal()) * 25);
this.gotoAndStop(loaded);
if (loaded >= 25) {
_root.gotoAndStop(2);
}
}
Frame 2
Key.removeListener(keyTrack);
clearInterval(windInterval);
inGame = false;
Frame 3
stop();
inGame = true;
balloonsPoppedTotal = 0;
balloonsMissedTotal = 0;
arrowsShotTotal = 0;
wind = 0;
windInterval = setInterval(changeWind, 500);
angle = 0;
power = 0;
balloonDepth = 50;
counter = 0;
maxCounter = 100;
score = 0;
aI = 0;
arrowsInMotion = 0;
reloading = false;
Balloons = new Array();
Balloons.splice(0, Balloons.length);
Key.addListener(keyTrack);
if (gameType == "tournament") {
arrowsLeft = 5;
arrowsLeftContainer._visible = true;
} else if (gameType == "practice") {
arrowsLeftContainer._visible = false;
}
_root.onEnterFrame = function () {
if (!reloading) {
updateBow();
}
if (mouseIsDown && (controlStyle == "mouse")) {
if ((power < 25) && (!reloading)) {
if ((gameType == "practice") && (!reloading)) {
power++;
updatePower();
} else if (arrowsLeft > 0) {
power++;
updatePower();
}
}
}
if (controlStyle == "keyboard") {
if (Key.isDown(32)) {
if ((power < 25) && (!reloading)) {
if ((gameType == "practice") && (!reloading)) {
power++;
updatePower();
} else if (arrowsLeft > 0) {
power++;
updatePower();
}
}
}
if (Key.isDown(38) || (Key.isDown(39))) {
if ((angle <= 60) && (!reloading)) {
angle = angle + 2;
updateBow();
}
} else if (Key.isDown(40) || (Key.isDown(37))) {
if ((angle >= 2) && (!reloading)) {
angle = angle - 2;
updateBow();
}
}
}
counter++;
if (counter >= maxCounter) {
if (random(5) == 0) {
spawnBalloon(1);
spawnBalloon(random(2) + 2);
} else {
spawnBalloon(random(3) + 1);
}
counter = 0;
} else if ((counter == Math.round(maxCounter / 2)) && (random(3) == 0)) {
spawnBalloon(random(3) + 1);
}
};
Instance of Symbol 38 MovieClip [box] "boxY" in Frame 3
onClipEvent (load) {
this.swapDepths(1010);
}
Instance of Symbol 203 MovieClip "arrowsLeftContainer" in Frame 3
onClipEvent (load) {
this.swapDepths(1002);
}
Instance of Symbol 207 MovieClip "windFlag" in Frame 3
onClipEvent (load) {
gotoAndStop (5);
}
Instance of Symbol 224 MovieClip "barrels" in Frame 3
onClipEvent (load) {
this.swapDepths(1000);
}
Instance of Symbol 233 MovieClip "windFlag2" in Frame 3
onClipEvent (load) {
gotoAndStop (5);
}
Frame 4
scoreThingy.gotoandstop(1);
Key.removeListener(keyTrack);
inGame = false;
clearInterval(windInterval);
Symbol 5 MovieClip [brokenArrow] Frame 28
this.removeMovieClip();
Symbol 13 MovieClip [balloon] Frame 1
stop();
Symbol 13 MovieClip [balloon] Frame 17
this.removeMovieClip();
Symbol 46 MovieClip Frame 1
stop();
Symbol 46 MovieClip Frame 25
stop();
Symbol 54 Button
on (press) {
getURL ("http://www.wonpwn.com", "_blank");
}
Symbol 60 MovieClip Frame 1
if (this.sessionstarted != 1) {
this.arcade = new LoadVars();
this.sessionvars = new LoadVars();
this.arcade.gamename = "balloonhunter";
this.arcade.sessdo = "sessionstart";
this.arcade.sendAndLoad("arcade.php", sessionvars, "POST");
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;
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 76 Button
on (release) {
gameType = "tournament";
gotoAndStop (3);
}
Symbol 80 Button
on (release) {
_root.optionsBox.gotoAndPlay(2);
}
Symbol 99 Button
on (release) {
if ((username != "") && (password != "")) {
sender = new LoadVars();
sender.user = username;
sender.pass = password;
sender.onLoad = function () {
if (sender.login == "true") {
_root.gameType = "tournament";
_root.playerName = sender.user;
gotoGame = true;
play();
} else {
error = sender.error;
}
delete this;
};
sender.sendAndLoad("http://www.wonpwn.com/modules/Games/login.php", sender, "POST");
}
}
Symbol 104 Button
on (release) {
_root.gameType = "tournament";
_root.playerName = "Guest";
gotoGame = true;
play();
}
Symbol 111 Button
on (release) {
gotoGame = false;
play();
}
Symbol 116 Button
on (release) {
getURL ("http://www.wonpwn.com/modules.php?name=Your_Account&op=new_user", "_blank");
}
Symbol 121 Button
on (release) {
if ((username != "") && (password != "")) {
sender = new LoadVars();
sender.user = username;
sender.pass = password;
sender.onLoad = function () {
if (sender.login == "true") {
_root.gameType = "tournament";
_root.playerName = sender.user;
gotoGame = true;
play();
} else {
error = sender.error;
}
delete this;
};
sender.sendAndLoad("http://www.wonpwn.com/modules/Games/login.php", sender, "POST");
}
}
Symbol 122 Button
on (release) {
_root.gameType = "tournament";
_root.playerName = "Guest";
gotoGame = true;
play();
}
Symbol 123 Button
on (release) {
gotoGame = false;
play();
}
Symbol 124 Button
on (release) {
getURL ("http://www.wonpwn.com/modules.php?name=Your_Account&op=new_user", "_blank");
}
Symbol 84 MovieClip Frame 1
stop();
Symbol 84 MovieClip Frame 2
_root.practiceBtn.enabled = false;
_root.tourneyBtn.enabled = false;
_root.highscoreBtn.enabled = false;
_root.optionsBTN.enabled = false;
gotoGame = false;
Symbol 84 MovieClip Frame 15
error = "";
stop();
Symbol 84 MovieClip Frame 30
if (gotoGame) {
_root.gotoAndStop(3);
} else {
_root.practiceBtn.enabled = true;
_root.tourneyBtn.enabled = true;
_root.highscoreBtn.enabled = true;
_root.optionsBTN.enabled = true;
}
gotoAndStop (1);
Symbol 130 Button
on (release) {
gotoGame = false;
play();
}
Symbol 135 Button
on (release) {
if (_root.cloud._visible == true) {
_root.cloud._visible = false;
_root.cloudShadow._visible = false;
backgroundCloud = "Off";
} else {
_root.cloud._visible = true;
_root.cloudShadow._visible = true;
backgroundCloud = "On";
}
}
Symbol 140 Button
on (release) {
if (_quality == "HIGH") {
_quality = "BEST";
quality = "Best";
} else if (_quality == "BEST") {
_quality = "LOW";
quality = "Low";
} else if (_quality == "LOW") {
_quality = "MEDIUM";
quality = "Medium";
} else if (_quality == "MEDIUM") {
_quality = "High";
quality = "High";
}
}
Symbol 145 Button
on (release) {
if (_root.controlStyle == "mouse") {
_root.controlStyle = "keyboard";
controlStyle = "Keyboard";
} else {
_root.controlStyle = "mouse";
controlStyle = "Mouse";
}
}
Symbol 150 Button
on (release) {
if (_root.trackHeight == false) {
_root.trackHeight = true;
trackHeight = "On";
} else {
_root.trackHeight = false;
trackHeight = "Off";
}
}
Symbol 163 Button
on (release) {
gotoGame = false;
play();
}
Symbol 164 Button
on (release) {
if (_root.cloud._visible == true) {
_root.cloud._visible = false;
_root.cloudShadow._visible = false;
backgroundCloud = "Off";
} else {
_root.cloud._visible = true;
_root.cloudShadow._visible = true;
backgroundCloud = "On";
}
}
Symbol 165 Button
on (release) {
if (_quality == "HIGH") {
_quality = "BEST";
quality = "Best";
} else if (_quality == "BEST") {
_quality = "LOW";
quality = "Low";
} else if (_quality == "LOW") {
_quality = "MEDIUM";
quality = "Medium";
} else if (_quality == "MEDIUM") {
_quality = "High";
quality = "High";
}
}
Symbol 166 Button
on (release) {
if (_root.controlStyle == "mouse") {
_root.controlStyle = "keyboard";
controlStyle = "Keyboard";
} else {
_root.controlStyle = "mouse";
controlStyle = "Mouse";
}
}
Symbol 167 Button
on (release) {
if (_root.trackHeight == false) {
_root.trackHeight = true;
trackHeight = "On";
} else {
_root.trackHeight = false;
trackHeight = "Off";
}
}
Symbol 126 MovieClip Frame 1
stop();
Symbol 126 MovieClip Frame 2
_root.practiceBtn.enabled = false;
_root.tourneyBtn.enabled = false;
_root.highscoreBtn.enabled = false;
_root.optionsBTN.enabled = false;
Symbol 126 MovieClip Frame 15
if (_root.cloud._visible == true) {
backgroundCloud = "On";
} else {
backgroundCloud = "Off";
}
if (_quality == "HIGH") {
quality = "High";
} else if (_quality == "BEST") {
quality = "Best";
} else if (_quality == "LOW") {
quality = "Low";
} else if (_quality == "MEDIUM") {
quality = "Medium";
}
if (_root.controlStyle == "mouse") {
controlStyle = "Mouse";
} else {
controlStyle = "Keyboard";
}
if (_root.trackHeight == false) {
trackHeight = "Off";
} else {
trackHeight = "On";
}
stop();
Symbol 126 MovieClip Frame 30
_root.practiceBtn.enabled = true;
_root.tourneyBtn.enabled = true;
_root.highscoreBtn.enabled = true;
_root.optionsBTN.enabled = true;
gotoAndStop (1);
Symbol 174 Button
on (release) {
gameType = "tournament";
gotoAndStop (3);
}
Symbol 178 MovieClip Frame 1
stop();
Symbol 178 MovieClip Frame 38
gotoAndStop (1);
_root.reloading = false;
Symbol 193 Button
on (release) {
_root.optionsBox.gotoAndPlay(2);
}
Symbol 204 MovieClip Frame 1
stop();
Symbol 218 Button
on (release) {
i = 0;
while (i < Balloons.length) {
_root[Balloons[i]].removeMovieClip();
i++;
}
delete Balloons;
barrels.swapDepths(-1);
arrowsLeftContainer.swapDepths(-2);
delete _root.onEnterFrame;
gotoAndStop (2);
}
Symbol 261 Button
on (release) {
i = 0;
while (i < Balloons.length) {
_root[Balloons[i]].removeMovieClip();
i++;
}
delete Balloons;
barrels.swapDepths(-1);
arrowsLeftContainer.swapDepths(-2);
gotoAndStop (2);
}
Symbol 262 Button
on (release) {
i = 0;
while (i < Balloons.length) {
_root[Balloons[i]].removeMovieClip();
i++;
}
delete Balloons;
barrels.swapDepths(-1);
arrowsLeftContainer.swapDepths(-2);
delete _root.onEnterFrame;
gotoAndStop (2);
}
Symbol 265 Button
on (release) {
_root.arrowsLeftContainer.swapDepths(-2);
_root.arrowsLeft = 5;
_root.gameType = "tournament";
_root.gotoAndStop(3);
}
Symbol 269 Button
on (release) {
_root.gameover = 1;
}
Symbol 274 Button
on (release) {
_root.arrowsLeftContainer.swapDepths(-2);
_root.arrowsLeft = 5;
_root.gameType = "tournament";
_root.gotoAndStop(3);
}
Symbol 278 Button
on (release) {
_root.arrowsLeftContainer.swapDepths(-2);
_root.arrowsLeft = 5;
_root.gameType = "tournament";
_root.gotoAndStop(3);
}
Symbol 281 Button
on (release) {
_root.gameover = 1;
}
Symbol 282 Button
on (release) {
i = 0;
while (i < Balloons.length) {
_root[Balloons[i]].removeMovieClip();
i++;
}
delete Balloons;
barrels.swapDepths(-1);
arrowsLeftContainer.swapDepths(-2);
gotoAndStop (2);
}