Frame 1
stop();
Frame 2
play();
Frame 4
stop();
_global.game = new Object();
game.speed = 0;
game.score = 0;
game.scoreIncrease = 0;
game.currentLevel = 0;
game.horsesInitialised = false;
game.activeItem = "";
game.activeItemList = new Array("helmet", "boots", "whip", "saddle");
game.activeItemTimer = 36;
game.activeItemCounter = 0;
game.raceTimer = 0;
game.playerStarted = false;
game.horsesInRace = ["player", "horse1", "horse2", "horse3"];
game.winningOrder = new Array();
game.winningDistances = new Array();
game.distanceCleared = "";
game.prizeMoney = "";
game.chosenName = "Player 1";
playBtn.onRelease = function () {
gotoAndPlay ("start");
};
instructionsBtn.onRelease = function () {
gotoAndPlay ("instructions");
};
moreBtn.onRelease = function () {
getURL ("http://www.playza.com", "_blank");
};
Frame 9
stop();
playBtn.onRelease = function () {
gotoAndPlay ("start");
};
backBtn.onRelease = function () {
gotoAndPlay ("main_menu");
};
Frame 13
stop();
playGameBtn.onRelease = function () {
game.chosenName = nameInputBox.text;
gotoAndPlay ("start_race");
};
Frame 19
stop();
var whack = new Sound();
whack.attachSound("THWACK02");
horse1.horseCrossed = false;
horse1.horseName = "lightning";
horse2.horseCrossed = false;
horse2.horseName = "jackal";
horse3.horseCrossed = false;
horse3.horseName = "cannon ball";
playerHorse.horseCrossed = false;
playerHorse.horseName = "player 1";
game.winningOrder.length = 0;
activateItem = function () {
if (game.activeItemCounter >= game.activeItemTimer) {
randomItem = random(4);
game.activeItem = game.activeItemList[randomItem];
game.activeItemTimer = random(60) + 12;
game.activeItemCounter = 0;
itemText.text = game.activeItem;
}
game.activeItemCounter++;
};
checkActiveItem = function (itemName) {
if (itemName == game.activeItem) {
game.speed = game.speed + 0.2;
} else {
game.speed = game.speed - 0.1;
}
};
horse1.onEnterFrame = function () {
var _local1 = this;
i = 1;
while (i <= 3) {
if (game.horsesInitialised == false) {
_local1._parent["horse" + i].randomStartSpeed = random(6) + 2;
_local1._parent["horse" + i].randomSpeed = random(8) - 4;
_local1._parent["horse" + i].randomInterval = random(30) + 10;
_local1._parent["horse" + i].intervalCounter = 0;
_local1._parent["horse" + i].isStarted = false;
}
if (i == 3) {
game.horsesInitialised = true;
}
if ((_local1._parent["horse" + i]._x <= 250) && (_local1._parent["horse" + i].isStarted == false)) {
_local1._parent["horse" + i]._x = _local1._parent["horse" + i]._x + _local1._parent["horse" + i].randomStartSpeed;
} else if ((_local1._parent["horse" + i]._x >= 250) && (_local1._parent["horse" + i].isStarted == false)) {
_local1._parent["horse" + i].isStarted = true;
} else {
_local1._parent["horse" + i]._x = _local1._parent["horse" + i]._x + _local1._parent["horse" + i].randomSpeed;
if (_local1._parent["horse" + i]._x < 120) {
_local1._parent["horse" + i]._x = 120;
} else if (_local1._parent["horse" + i]._x > 420) {
_local1._parent["horse" + i]._x = 420;
}
}
if (_local1._parent["horse" + i].randomInterval == _local1._parent["horse" + i].intervalCounter) {
_local1._parent["horse" + i].randomSpeed = random(8) - 4;
_local1._parent["horse" + i].intervalCounter = 0;
_local1._parent["horse" + i].randomInterval = random(30) + 10;
}
_local1._parent["horse" + i].intervalCounter++;
i++;
}
};
backTrack.onEnterFrame = function () {
var _local1 = this;
_local1._x = _local1._x - 20;
if (_local1._x <= -800) {
_local1._x = 0;
}
if (_local1._parent.traps._x > -100) {
_local1._parent.traps._x = _local1._parent.traps._x - 20;
}
};
playerHorse.onEnterFrame = function () {
var _local1 = this;
if ((game.playerStarted == false) && (_local1._x <= 250)) {
_local1._x = _local1._x + 6;
_local1.horseGlow._alpha = 30;
} else {
game.playerStarted = true;
_local1.horseGlow._alpha = 0;
}
if (game.playerStarted == true) {
_local1._x = _local1._x + game.speed;
game.speed = game.speed - 0.06;
if (_local1._x < 120) {
_local1._x = 120;
game.speed = 0;
} else if (_local1._x > 420) {
_local1._x = 420;
game.speed = 0;
}
}
activateItem();
};
endLine.onEnterFrame = function () {
var _local1 = this;
if (game.raceTimer >= 480) {
_local1._x = _local1._x - 20;
}
game.raceTimer++;
checkWinners(_local1._parent.horse1);
checkWinners(_local1._parent.horse2);
checkWinners(_local1._parent.horse3);
checkWinners(_local1._parent.playerHorse);
};
checkWinners = function (horseObject) {
var _local1 = horseObject;
if (endLine.hitTest(_local1) && (_local1.horseCrossed == false)) {
game.winningOrder.push(_local1.horseName);
_local1.horseCrossed = true;
distances = new Array();
trace(game.winningOrder);
if (game.winningOrder.length == 1) {
if (_local1.horseName != "lightning") {
temp = _local1._x - horse1._x;
distances.push(temp);
}
if (_local1.horseName != "jackal") {
temp = _local1._x - horse2._x;
distances.push(temp);
}
if (_local1.horseName != "cannon ball") {
temp = _local1._x - horse3._x;
distances.push(temp);
}
if (_local1.horseName != "player 1") {
temp = _local1._x - playerHorse._x;
distances.push(temp);
}
smallnum1 = Math.min(distances[0], distances[1]);
smallnum2 = Math.min(distances[0], distances[2]);
smallestnum = Math.min(smallnum1, smallnum2);
trace(distances);
trace(smallestnum);
calcDistances(smallestnum);
}
}
if (game.winningOrder.length == 4) {
gotoAndPlay ("results");
}
};
calcDistances = function (distance) {
var _local1 = distance;
if (_local1 <= 15) {
game.distanceCleared = "short-head";
game.prizeMoney = "$50,000";
} else if (_local1 <= 30) {
game.distanceCleared = "head";
game.prizeMoney = "$75,000";
} else if (_local1 <= 50) {
game.distanceCleared = "neck";
game.prizeMoney = "$100,000";
} else if (_local1 <= 95) {
game.distanceCleared = "half length";
game.prizeMoney = "$250,000";
} else if (_local1 <= 190) {
game.distanceCleared = "length";
game.prizeMoney = "$500,000";
} else if (_local1 <= 300) {
game.distanceCleared = "2 lengths";
game.prizeMoney = "$1,000,000";
}
};
helmetBtn.onPress = function () {
checkActiveItem("helmet");
};
bootsBtn.onPress = function () {
checkActiveItem("boots");
};
whipBtn.onPress = function () {
checkActiveItem("whip");
};
saddleBtn.onPress = function () {
checkActiveItem("saddle");
};
var gallop1 = new Sound();
gallop1.attachSound("gallop1");
var gallop2 = new Sound();
gallop2.attachSound("gallop2");
var gallop3 = new Sound();
gallop3.attachSound("gallop3");
Frame 22
if (game.winningOrder[0] == "player 1") {
prizeTextBox.text = "you just won " + game.prizeMoney;
resultsTextBox.text = ((((((game.chosenName + newline) + game.winningOrder[1]) + newline) + game.winningOrder[2]) + newline) + game.winningOrder[3]) + newline;
} else if (game.winningOrder[1] == "player 1") {
resultsTextBox.text = ((((((game.winningOrder[0] + newline) + game.chosenName) + newline) + game.winningOrder[2]) + newline) + game.winningOrder[3]) + newline;
} else if (game.winningOrder[2] == "player 1") {
resultsTextBox.text = ((((((game.winningOrder[0] + newline) + game.winningOrder[1]) + newline) + game.chosenName) + newline) + game.winningOrder[3]) + newline;
} else if (game.winningOrder[3] == "player 1") {
resultsTextBox.text = ((((((game.winningOrder[0] + newline) + game.winningOrder[1]) + newline) + game.winningOrder[2]) + newline) + game.chosenName) + newline;
}
distanceTextBox.text = game.distanceCleared;
if (game.winningOrder[0] == "player 1") {
playerResultBg._y = 125;
} else if (game.winningOrder[1] == "player 1") {
playerResultBg._y = 149;
} else if (game.winningOrder[2] == "player 1") {
playerResultBg._y = 173;
} else if (game.winningOrder[3] == "player 1") {
playerResultBg._y = 198;
}
if (game.winningOrder[0] == "player 1") {
gotoAndPlay ("first_place");
}
againBtn.onRelease = function () {
gotoAndPlay ("main_menu");
};
downloadBtn.onRelease = function () {
getURL ("http://www.playza.com", "_blank");
};
Frame 23
stop();
Frame 24
stop();
againBtn.onRelease = function () {
gotoAndPlay ("main_menu");
};
downloadBtn.onRelease = function () {
getURL ("http://www.playza.com", "_blank");
};
Symbol 11 MovieClip Frame 1
_root.stop();
PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (PercentLoaded != 100) {
setProperty(bar, _xscale , PercentLoaded);
} else {
_root.gotoAndStop(2);
}
Symbol 11 MovieClip Frame 2
gotoAndPlay (1);
Symbol 15 Button
on (release) {
getURL ("http://www.playza.com");
}