Frame 1
function deadClick() {
}
function gotoMySite() {
getURL ("http://www.stoneagegames.com", "_blank");
}
var myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
var copyrightNotice = new ContextMenuItem("\u00A9 2008 stoneagegames.com", deadClick);
copyrightNotice.separatorBefore = true;
var mySiteLink = new ContextMenuItem("Designed by avgames.co.uk", gotoMySite);
myMenu.customItems.push(mySiteLink, copyrightNotice);
_root.menu = myMenu;
bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded / bytes_total;
_root.loadBar._width = getPercent * 100;
_root.loadText = Math.round(getPercent * 100) + "%";
if (bytes_loaded == bytes_total) {
_root.gotoAndPlay(4);
}
Instance of Symbol 13 MovieClip in Frame 1
on (release) {
getURL ("http://www.stoneagegames.com", "_blank");
}
Frame 2
gotoAndPlay (1);
Instance of Symbol 644 MovieClip in Frame 4
on (release) {
getURL ("http://www.stoneagegames.com", "_blank");
}
Frame 93
stop();
Instance of Symbol 671 MovieClip in Frame 93
on (release) {
_root.gotoAndStop("start");
}
Instance of Symbol 673 MovieClip in Frame 93
on (release) {
getURL ("http://www.stoneagegames.com/games/425 ", "_blank");
}
Instance of Symbol 675 MovieClip in Frame 93
on (release) {
getURL (" http://www.stoneagegames.com/hiscore/2", "_blank");
}
Instance of Symbol 677 MovieClip in Frame 93
on (release) {
getURL ("http://www.stoneagegames.com/gallery", "_blank");
}
Instance of Symbol 682 MovieClip in Frame 93
on (release) {
getURL ("http://www.stoneagegames.com", "_blank");
}
Instance of Symbol 687 MovieClip in Frame 93
on (release) {
getURL ("http://www.stoneagegames.com/html/9/", "_blank");
}
Frame 94
stop();
Instance of Symbol 714 MovieClip in Frame 94
on (release) {
_root.gotoAndStop("levelOne");
}
Frame 95
function guardianFacePlayer() {
if (!guardianDead) {
if (player._x > enemyGuardian._x) {
enemyGuardian._xscale = -100;
} else {
enemyGuardian._xscale = 100;
}
}
}
function guardianWillKillYou() {
if (youAreFucked) {
enemyGuardian.gotoAndStop("attack");
attachGuardianHit++;
if (attachGuardianHit == 20) {
_root.attachMovie("guardian_hit", "guardian_hit", _root.getNextHighestDepth(), {_x:enemyGuardian._x, _y:enemyGuardian._y});
attachGuardianHit = 0;
youAreFucked = false;
}
}
}
function randomAttack() {
if (!guardianDead) {
if (dino_speed == 5000) {
youAreFucked = true;
}
}
}
function bossKilled() {
if (AmountOfEnemies == 0) {
guardianDead = true;
}
}
function playerVsGuardian() {
if (!guardianDead) {
if (!youAreFucked) {
if (enemyGuardian.hitTest(_root.player_hit) or enemyGuardian.hitTest(_root.friendly_hit)) {
guardianHealth = guardianHealth - 1;
dino_speed = 5000;
} else {
dino_speed = 350;
}
if (enemyGuardian.hitTest(_root.player)) {
youAreFucked = true;
if (_root.player.hitTest(guardian_hit)) {
playerHealth = playerHealth - 15;
taking_damage = true;
}
} else {
enemyGuardian.gotoAndStop("walk");
}
}
}
}
function enemyGuardianMoveToPlayer() {
if (!guardianDead) {
if (grass._x < -4335) {
releaseGuardian = true;
}
if (releaseGuardian) {
endX = _root.player._x;
enemyGuardian._x = enemyGuardian._x + ((endX - enemyGuardian._x) / dino_speed);
}
}
}
function murkFriendlyUnits() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(guardian_hit)) {
UnitHealth[i] = UnitHealth[i] - 2;
}
if (hold_friendlyUnit[i].hitTest(enemy_hit)) {
UnitHealth[i] = UnitHealth[i] - 3;
}
if (UnitHealth[i] < 1) {
maxUnits--;
randomNumber++;
_root.attachMovie("friendly_dead", "friendly_dead" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
friendlyWalking.splice(i, 1);
UnitframeNumber.splice(i, 1);
UnitHealth.splice(i, 1);
}
i--;
}
}
function helpUnitsVsEnemyUnits() {
j = hold_enemyUnit.length - 1;
while (j >= 0) {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_enemyUnit[j].hitTest(hold_friendlyUnit[i]) or hold_friendlyUnit[i].hitTest(enemyGuardian)) {
friendlyWalking[i] = false;
hold_friendlyUnit[i].gotoAndStop("attack");
UnitframeNumber[i]++;
if (UnitframeNumber[i] == 9) {
randomNumber++;
friendly_hit = _root.attachMovie("unit_attack", "unit_attack" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
UnitframeNumber[i] = 0;
}
} else {
friendlyWalking[i] = true;
hold_friendlyUnit[i].gotoAndStop("walk");
}
i--;
}
j--;
}
}
function friendlyMove() {
if (!Pause) {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (friendlyWalking[i] == true) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x + (Math.round(Math.random() * 2) + 1);
}
i--;
}
}
}
function enemyMoveToPlayer() {
if (!Pause) {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (enemyWalking[i] == true) {
endX = _root.player._x;
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x + ((endX - hold_enemyUnit[i]._x) / 50);
}
i--;
}
}
}
function facePlayer() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (player._x > hold_enemyUnit[i]._x) {
enemyFacingRight[i] = true;
hold_enemyUnit[i]._xscale = -100;
} else {
enemyFacingRight[i] = false;
hold_enemyUnit[i]._xscale = 100;
}
i--;
}
}
function enemyActions() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (hold_enemyUnit[i].hitTest(_root.player_hit) or hold_enemyUnit[i].hitTest(friendly_hit)) {
enemyHealth[i] = enemyHealth[i] - 1;
enemyWalking[i] = false;
attachBlood++;
if (attachBlood == 10) {
hit_sound.start();
randomNumber++;
if (enemyFacingRight[i] == false) {
blood_ = _root.attachMovie("blood", "blood" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x - 28, _y:hold_enemyUnit[i]._y - 30});
} else {
blood_ = _root.attachMovie("blood", "blood" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x - 60, _y:hold_enemyUnit[i]._y - 30});
}
blood_._xscale = 50;
blood_._yscale = 50;
attachBlood = 0;
}
if (enemyHealth[i] < 1) {
AmountOfEnemies--;
exp = exp + 5;
randomNumber++;
deadE_ = _root.attachMovie("deadE", "deadE" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x, _y:hold_enemyUnit[i]._y});
if (enemyFacingRight[i] == true) {
deadE_._xscale = -100;
}
score = score + 10;
maxEnemies--;
hold_enemyUnit[i].removeMovieClip();
hold_enemyUnit.splice(i, 1);
frameNumber.splice(i, 1);
enemyHealth.splice(i, 1);
enemyWalking.splice(i, 1);
enemyFacingRight.splice(i, 1);
}
}
if (hold_enemyUnit[i].hitTest(_root.player)) {
frameNumber[i]++;
if (frameNumber[i] == 18) {
if (enemyFacingRight[i] == false) {
_root.attachMovie("enemy_hit", "enemy_hit", _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x, _y:hold_enemyUnit[i]._y});
} else {
_root.attachMovie("enemy_hit", "enemy_hit", _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x + 80, _y:hold_enemyUnit[i]._y});
}
}
enemyWalking[i] = false;
hold_enemyUnit[i].gotoAndStop("attack");
if (_root.player.hitTest(enemy_hit)) {
playerHealth--;
taking_damage = true;
frameNumber[i] = 0;
}
} else {
frameNumber[i] = 0;
enemyWalking[i] = true;
hold_enemyUnit[i].gotoAndStop("walk");
}
i--;
}
}
function attachEnemyUnit() {
if (!Pause) {
if (!guardianDead) {
if (maxEnemies < 11) {
releaseEnemyUnitTimer = releaseEnemyUnitTimer - 1;
if (releaseEnemyUnitTimer == 0) {
maxEnemies++;
dir = ["left", "right"];
randNum = random(2);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomNumber++;
Enemy_Unit = _root.attachMovie("enemyUnit", "enemyUnit" + randomNumber, _root.getNextHighestDepth(), {_x:-20, _y:355});
hold_enemyUnit.push(Enemy_Unit);
frameNumber.push(0);
enemyHealth.push(10);
enemyWalking.push(true);
enemyFacingRight.push(false);
break;
case "right" :
randomNumber++;
Enemy_Unit = _root.attachMovie("enemyUnit", "enemyUnit" + randomNumber, _root.getNextHighestDepth(), {_x:600, _y:355});
hold_enemyUnit.push(Enemy_Unit);
frameNumber.push(0);
enemyHealth.push(10);
enemyWalking.push(true);
enemyFacingRight.push(false);
}
releaseEnemyUnitTimer = 40;
}
}
}
}
}
function ereaseFriendlyUnit() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i]._x > 9000) {
maxUnits--;
randomNumber++;
_root.attachMovie("friendly_dead", "friendly_dead" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
friendlyWalking.splice(i, 1);
UnitframeNumber.splice(i, 1);
UnitHealth.splice(i, 1);
}
i--;
}
}
function moveFriendlyLeft() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x - 5;
i--;
}
}
function moveFriendlyRight() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x + 5;
i--;
}
}
function moveEnemyLeft() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x - 5;
i--;
}
}
function moveEnemyRight() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x + 5;
i--;
}
}
function restrictFirst() {
if (is_attacking < 0) {
is_attacking = 0;
attacking = false;
}
}
function restrictSecond() {
if (is_attacking2 < 0) {
is_attacking2 = 0;
attacking = false;
}
}
function restrictThird() {
if (is_attacking3 < 0) {
is_attacking3 = 0;
attacking = false;
}
}
function playerJump() {
yspeed = yspeed + down_force;
_root.player._y = _root.player._y + yspeed;
}
function playerOnGround() {
if (player._y > 365) {
_root.player._y = 365;
airCombo = 3;
yspeed = 0;
jumping = false;
jump_power = 15;
down_force = 0;
}
}
function addComboPoint() {
if (mouseDown_) {
if ((is_attacking > 0) && (is_attacking < 6)) {
combo = 1;
}
if ((is_attacking2 > 0) && (is_attacking2 < 6)) {
combo = 2;
}
}
}
function hover() {
if (attacking) {
down_force = 0;
yspeed = 0;
} else {
down_force = 1;
}
}
function playerCombo1() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 0) {
is_attacking = is_attacking - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack1");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack1");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
}
}
}
}
}
}
}
function playerCombo2() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 1) {
is_attacking = 0;
is_attacking2 = is_attacking2 - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack2");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack2");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
}
}
}
}
}
}
}
function playerCombo3() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 2) {
is_attacking2 = 0;
is_attacking3 = is_attacking3 - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack3");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack3");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
combo = 0;
}
}
}
}
}
}
}
function beingHit() {
if (taking_damage) {
ouch = ouch - 1;
if (!jumping) {
player.gotoAndPlay("hitGround");
} else {
player.gotoAndPlay("hitAir");
}
if (ouch == 0) {
hit_sound.start();
taking_damage = false;
ouch = 3;
}
}
}
function correct_player_hit_placement() {
if (going_right) {
_root.player_hit._xscale = 100;
}
if (going_left) {
_root.player_hit._xscale = -100;
}
}
function playerMovements() {
if (!taking_damage) {
if (!attacking) {
if (Key.isDown(38) or Key.isDown(87)) {
yspeed = yspeed - jump_power;
jumping = true;
jump_power = 0;
down_force = 1;
player.gotoAndStop("jump");
}
if (Key.isDown(39) or Key.isDown(68)) {
going_left = false;
going_right = true;
_root.player._xscale = 100;
_root.player._x = _root.player._x + playerSpeed;
if (!jumping) {
player.gotoAndStop("running");
}
} else if (Key.isDown(37) or Key.isDown(65)) {
going_left = true;
going_right = false;
_root.player._xscale = -100;
_root.player._x = _root.player._x - playerSpeed;
if (!jumping) {
player.gotoAndStop("running");
}
} else if (!jumping) {
player.gotoAndStop("idle");
}
}
}
}
function Bounds() {
if (player._x > 380) {
if (_root.grass._x > -2335) {
moveFriendlyLeft();
moveEnemyLeft();
enemyGuardian._x = enemyGuardian._x - 15;
_root.deadE_._x = _root.deadE_._x - 15;
_root.player._x = 380;
_root.grass._x = _root.grass._x - 15;
_root.city._x = _root.city._x - 12;
_root.sky._x = _root.sky._x - 1;
_root.mountains._x = _root.mountains._x - 2;
} else {
_root.player._x = 380;
if (!jumping) {
_root.player.gotoAndStop("idle");
} else {
_root.player.gotoAndStop("jump");
}
enemyGuardian._x = enemyGuardian._x - 0;
_root.deadE_._x = _root.deadE_._x - 0;
_root.grass._x = _root.grass._x - 0;
_root.city._x = _root.city._x - 0;
_root.sky._x = _root.sky._x - 0;
_root.mountains._x = _root.mountains._x - 0;
}
} else if (player._x < 150) {
if (_root.grass._x < -20) {
moveFriendlyRight();
moveEnemyRight();
enemyGuardian._x = enemyGuardian._x + 15;
_root.deadE_._x = _root.deadE_._x + 15;
_root.player._x = 150;
_root.grass._x = _root.grass._x + 15;
_root.city._x = _root.city._x + 12;
_root.sky._x = _root.sky._x + 1;
_root.mountains._x = _root.mountains._x + 2;
} else {
_root.player._x = 150;
if (!jumping) {
_root.player.gotoAndStop("idle");
} else {
_root.player.gotoAndStop("jump");
}
enemyGuardian._x = enemyGuardian._x + 0;
_root.deadE_._x = _root.deadE_._x + 0;
_root.grass._x = _root.grass._x + 0;
_root.city._x = _root.city._x + 0;
_root.sky._x = _root.sky._x + 0;
_root.mountains._x = _root.mountains._x + 0;
}
}
}
function attatchUnit() {
if (exp > 9) {
if (maxUnits < 11) {
if (releaseUnit) {
releaseTimer = releaseTimer - 1;
}
if (releaseTimer == 0) {
releaseUnit = false;
releaseTimer = 90;
exp = exp - 10;
maxUnits++;
randomNumber++;
friendlyUnit = attachMovie("friendly", "friendly" + randomNumber, _root.getNextHighestDepth(), {_x:-300, _y:360});
hold_friendlyUnit.push(friendlyUnit);
friendlyWalking.push(true);
UnitframeNumber.push(0);
UnitHealth.push(15);
}
}
}
}
function blockMinusExp() {
if (exp < 0) {
exp = 0;
}
}
function pause_game() {
if (!Pause) {
if (Key.isDown(80)) {
Mouse.show();
Pause = true;
_root.attachMovie("pauseScreen", "pauseScreen", _root.getNextHighestDepth(), {_x:0, _y:0});
}
}
}
function unpause_game() {
if (Pause) {
if (Key.isDown(85)) {
Mouse.hide();
Pause = false;
pauseScreen.removeMovieClip();
}
}
}
function gameOver() {
if (playerHealth < 1) {
removefriendlyWalking();
removeenemyFacingRight();
removeenemyWalking();
removeUnitHealth();
removeenemyHealth();
removeUnitframeNumber();
removeframeNumber();
removehold_enemyUnit();
removehold_friendlyUnit();
player.removeMovieClip();
enemyGuardian.removeMovieClip();
stopAllSounds();
warning.removeMovieClip();
gotoAndStop ("game_over1");
}
}
function gameOverVictory() {
if (guardianDead) {
if (maxEnemies == 0) {
level = 2;
removefriendlyWalking();
removeenemyFacingRight();
removeenemyWalking();
removeUnitHealth();
removeenemyHealth();
removeUnitframeNumber();
removeframeNumber();
removehold_enemyUnit();
removehold_friendlyUnit();
warning.removeMovieClip();
delay++;
if (delay == 96) {
player.removeMovieClip();
enemyGuardian.removeMovieClip();
stopAllSounds();
gotoAndStop ("game_over_victory1");
}
}
}
}
function removehold_friendlyUnit() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
i--;
}
}
function removehold_enemyUnit() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i].removeMovieClip();
hold_enemyUnit.splice(i, 1);
i--;
}
}
function removeframeNumber() {
i = frameNumber.length - 1;
while (i >= 0) {
frameNumber[i].removeMovieClip();
frameNumber.splice(i, 1);
i--;
}
}
function removeUnitframeNumber() {
i = UnitframeNumber.length - 1;
while (i >= 0) {
UnitframeNumber[i].removeMovieClip();
UnitframeNumber.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removeUnitHealth() {
i = UnitHealth.length - 1;
while (i >= 0) {
UnitHealth[i].removeMovieClip();
UnitHealth.splice(i, 1);
i--;
}
}
function removeenemyWalking() {
i = enemyWalking.length - 1;
while (i >= 0) {
enemyWalking[i].removeMovieClip();
enemyWalking.splice(i, 1);
i--;
}
}
function removeenemyFacingRight() {
i = enemyFacingRight.length - 1;
while (i >= 0) {
enemyFacingRight[i].removeMovieClip();
enemyFacingRight.splice(i, 1);
i--;
}
}
function removefriendlyWalking() {
i = friendlyWalking.length - 1;
while (i >= 0) {
friendlyWalking[i].removeMovieClip();
friendlyWalking.splice(i, 1);
i--;
}
}
function moreExpNeeded() {
if (exp < 10) {
needexp._x = -4.3;
needexp._y = 72.8;
} else {
needexp._x = -50;
needexp._y = -50;
}
}
function maximumUnits() {
if (maxUnits > 10) {
maximum_units._x = 22.1;
maximum_units._y = 32.6;
} else {
maximum_units._x = -50;
maximum_units._y = -50;
}
}
function theMouseIssue() {
Mouse.hide();
endX = _root._xmouse;
endY = _root._ymouse;
Icon._x = Icon._x + (endX - Icon._x);
Icon._y = Icon._y + (endY - Icon._y);
if (mouseArea.hitTest(_root._xmouse, _root._ymouse, true)) {
Icon.gotoAndStop("one");
} else {
Icon.gotoAndStop("two");
}
}
function attachWarning() {
if (grass._x < -2335) {
onlyOnce++;
if (onlyOnce == 1) {
warningTwo.removeMovieClip();
}
}
}
function unitVsGuardianWaning() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(enemyGuardian)) {
if (hold_friendlyUnit[i]._x > (player._x + 700)) {
onceAgain++;
if (onceAgain == 1) {
warning.removeMovieClip();
_root.attachMovie("warningTwo", "warningTwo", _root.getNextHighestDepth(), {_x:140, _y:145});
}
} else {
onceAgain = 0;
}
}
i--;
}
}
stop();
score = 0;
AmountOfEnemies = 50;
onceAgain = 0;
onlyOnce = 0;
playonce = 0;
youAreFucked = false;
FSdeath_sound = new Sound();
FSdeath_sound.attachSound("FSdeath");
hit_sound = new Sound();
hit_sound.attachSound("hit");
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:340, _y:365});
_root.attachMovie("objective1", "objective1", _root.getNextHighestDepth(), {_x:65, _y:140});
var hold_friendlyUnit = new Array();
var hold_enemyUnit = new Array();
var frameNumber = new Array();
var UnitframeNumber = new Array();
var enemyHealth = new Array();
var UnitHealth = new Array();
var enemyWalking = new Array();
var enemyFacingRight = new Array();
var friendlyWalking = new Array();
level = 1;
playerHealth = 500;
dino_speed = 350;
playerSpeed = 10;
down_force = 1;
yspeed = 0;
locked = false;
jumping = false;
jump_power = 15;
taking_damage = false;
going_left = false;
going_right = true;
attacking = false;
mouseDown_ = false;
releaseUnit = false;
enemyTakingDamage = false;
randomNumber = 0;
is_attacking = 0;
is_attacking2 = 0;
is_attacking3 = 0;
unitSpeed = 5;
comboTimer = 45;
combo = 0;
releaseTimer = 90;
runningRight = false;
runningLeft = false;
ouch = 3;
releaseEnemyUnitTimer = 260;
attachBlood = 0;
attachGuardianHit = 0;
guardianHealth = 150;
releaseGuardian = false;
maxUnits = 0;
maxEnemies = 0;
exp = 0;
delay = 0;
Pause = false;
guardianDead = false;
_root.onMouseUp = function () {
mouseDown_ = false;
down_force = 1;
};
_root.onMouseDown = function () {
mouseDown_ = true;
if (!add_unit1.hitTest(_root._xmouse, _root._ymouse, true)) {
attacking = true;
if (combo == 0) {
if (is_attacking == 0) {
is_attacking = 20;
}
}
if (combo == 1) {
if (is_attacking2 == 0) {
is_attacking2 = 11;
}
}
if (combo == 2) {
if (is_attacking3 == 0) {
is_attacking3 = 11;
}
}
}
};
add_unit1.onEnterFrame = function () {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
add_unit1.gotoAndStop("down");
if (mouseDown_) {
releaseUnit = true;
}
} else {
add_unit1.gotoAndStop("up");
}
};
player.onEnterFrame = function () {
if (!Pause) {
blockMinusExp();
ereaseFriendlyUnit();
moveFriendlyLeft();
moveFriendlyRight();
attatchUnit();
playerCombo1();
playerCombo2();
playerCombo3();
playerMovements();
playerJump();
playerOnGround();
Bounds();
addComboPoint();
restrictFirst();
restrictSecond();
restrictThird();
beingHit();
hover();
correct_player_hit_placement();
attachEnemyUnit();
enemyActions();
facePlayer();
enemyMoveToPlayer();
helpUnitsVsEnemyUnits();
friendlyMove();
enemyGuardianMoveToPlayer();
playerVsGuardian();
murkFriendlyUnits();
randomAttack();
guardianFacePlayer();
bossKilled();
moreExpNeeded();
maximumUnits();
guardianWillKillYou();
theMouseIssue();
attachWarning();
unitVsGuardianWaning();
if (AmountOfEnemies < 0) {
AmountOfEnemies = 0;
}
}
};
ppp.onEnterFrame = function () {
gameOverVictory();
gameOver();
pause_game();
unpause_game();
};
Frame 96
function guardianFacePlayer() {
if (!guardianDead) {
if (player._x > enemyGuardian._x) {
enemyGuardian._xscale = -100;
} else {
enemyGuardian._xscale = 100;
}
}
}
function guardianWillKillYou() {
if (youAreFucked) {
enemyGuardian.gotoAndStop("attack");
attachGuardianHit++;
if (attachGuardianHit == 20) {
_root.attachMovie("enemy_hitep2", "guardian_hit", _root.getNextHighestDepth(), {_x:enemyGuardian._x, _y:enemyGuardian._y});
attachGuardianHit = 0;
youAreFucked = false;
}
}
}
function randomAttack() {
if (!guardianDead) {
if (dino_speed == 5000) {
youAreFucked = true;
}
}
}
function bossKilled() {
if (guardianHealth < 1) {
guardianDead = true;
playonce++;
if (playonce == 1) {
score = score + 50;
FSdeath_sound.start();
dieN_ = _root.attachMovie("deadEepic", "deadE" + randomNumber, _root.getNextHighestDepth(), {_x:enemyGuardian._x, _y:enemyGuardian._y});
if (enemyGuardian._x == -100) {
dieN_._xscale = -100;
}
enemyGuardian.removeMovieClip();
}
}
}
function playerVsGuardian() {
if (!guardianDead) {
if (!youAreFucked) {
if (enemyGuardian.hitTest(_root.player_hit) or enemyGuardian.hitTest(_root.friendly_hit)) {
guardianHealth = guardianHealth - 1;
dino_speed = 5000;
} else {
dino_speed = 350;
}
if (enemyGuardian.hitTest(_root.player)) {
youAreFucked = true;
if (_root.player.hitTest(guardian_hit)) {
playerHealth = playerHealth - 15;
taking_damage = true;
}
} else {
enemyGuardian.gotoAndStop("walk");
}
}
}
}
function enemyGuardianMoveToPlayer() {
if (!guardianDead) {
releaseGuardian = true;
if (releaseGuardian) {
endX = _root.player._x;
enemyGuardian._x = enemyGuardian._x + ((endX - enemyGuardian._x) / dino_speed);
}
}
}
function murkFriendlyUnits() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(guardian_hit)) {
UnitHealth[i] = UnitHealth[i] - 2;
}
if (hold_friendlyUnit[i].hitTest(enemy_hit)) {
UnitHealth[i] = UnitHealth[i] - 3;
}
if (UnitHealth[i] < 1) {
maxUnits--;
randomNumber++;
_root.attachMovie("friendly_dead", "friendly_dead" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
friendlyWalking.splice(i, 1);
UnitframeNumber.splice(i, 1);
UnitHealth.splice(i, 1);
}
i--;
}
}
function helpUnitsVsEnemyUnits() {
j = hold_enemyUnit.length - 1;
while (j >= 0) {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_enemyUnit[j].hitTest(hold_friendlyUnit[i]) or hold_friendlyUnit[i].hitTest(enemyGuardian)) {
friendlyWalking[i] = false;
hold_friendlyUnit[i].gotoAndStop("attack");
UnitframeNumber[i]++;
if (UnitframeNumber[i] == 9) {
randomNumber++;
friendly_hit = _root.attachMovie("unit_attack", "unit_attack" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
UnitframeNumber[i] = 0;
}
} else {
friendlyWalking[i] = true;
hold_friendlyUnit[i].gotoAndStop("walk");
}
i--;
}
j--;
}
}
function friendlyMove() {
if (!Pause) {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (friendlyWalking[i] == true) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x + (Math.round(Math.random() * 2) + 1);
}
i--;
}
}
}
function enemyMoveToPlayer() {
if (!Pause) {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (enemyWalking[i] == true) {
endX = _root.player._x;
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x + ((endX - hold_enemyUnit[i]._x) / 50);
}
i--;
}
}
}
function facePlayer() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (player._x > hold_enemyUnit[i]._x) {
enemyFacingRight[i] = true;
hold_enemyUnit[i]._xscale = -100;
} else {
enemyFacingRight[i] = false;
hold_enemyUnit[i]._xscale = 100;
}
i--;
}
}
function enemyActions() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (hold_enemyUnit[i].hitTest(_root.player_hit) or hold_enemyUnit[i].hitTest(friendly_hit)) {
enemyHealth[i] = enemyHealth[i] - 1;
enemyWalking[i] = false;
attachBlood++;
if (attachBlood == 10) {
hit_sound.start();
randomNumber++;
if (enemyFacingRight[i] == false) {
blood_ = _root.attachMovie("blood", "blood" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x - 28, _y:hold_enemyUnit[i]._y - 30});
} else {
blood_ = _root.attachMovie("blood", "blood" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x - 60, _y:hold_enemyUnit[i]._y - 30});
}
blood_._xscale = 50;
blood_._yscale = 50;
attachBlood = 0;
}
if (enemyHealth[i] < 1) {
exp = exp + 5;
score = score + 10;
randomNumber++;
deadE_ = _root.attachMovie("deadE", "deadE" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x, _y:hold_enemyUnit[i]._y});
if (enemyFacingRight[i] == true) {
deadE_._xscale = -100;
}
maxEnemies--;
hold_enemyUnit[i].removeMovieClip();
hold_enemyUnit.splice(i, 1);
frameNumber.splice(i, 1);
enemyHealth.splice(i, 1);
enemyWalking.splice(i, 1);
enemyFacingRight.splice(i, 1);
}
}
if (hold_enemyUnit[i].hitTest(_root.player)) {
frameNumber[i]++;
if (frameNumber[i] == 18) {
if (enemyFacingRight[i] == false) {
_root.attachMovie("enemy_hit", "enemy_hit", _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x, _y:hold_enemyUnit[i]._y});
} else {
_root.attachMovie("enemy_hit", "enemy_hit", _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x + 80, _y:hold_enemyUnit[i]._y});
}
}
enemyWalking[i] = false;
hold_enemyUnit[i].gotoAndStop("attack");
if (_root.player.hitTest(enemy_hit)) {
playerHealth--;
taking_damage = true;
frameNumber[i] = 0;
}
} else {
frameNumber[i] = 0;
enemyWalking[i] = true;
hold_enemyUnit[i].gotoAndStop("walk");
}
i--;
}
}
function attachEnemyUnit() {
if (!Pause) {
if (!guardianDead) {
if (maxEnemies < 11) {
releaseEnemyUnitTimer = releaseEnemyUnitTimer - 1;
if (releaseEnemyUnitTimer == 0) {
maxEnemies++;
dir = ["left", "right"];
randNum = random(2);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomNumber++;
Enemy_Unit = _root.attachMovie("enemyUnit", "enemyUnit" + randomNumber, _root.getNextHighestDepth(), {_x:-20, _y:355});
hold_enemyUnit.push(Enemy_Unit);
frameNumber.push(0);
enemyHealth.push(10);
enemyWalking.push(true);
enemyFacingRight.push(false);
break;
case "right" :
randomNumber++;
Enemy_Unit = _root.attachMovie("enemyUnit", "enemyUnit" + randomNumber, _root.getNextHighestDepth(), {_x:600, _y:355});
hold_enemyUnit.push(Enemy_Unit);
frameNumber.push(0);
enemyHealth.push(10);
enemyWalking.push(true);
enemyFacingRight.push(false);
}
releaseEnemyUnitTimer = 90;
}
}
}
}
}
function ereaseFriendlyUnit() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i]._x > 9000) {
maxUnits--;
randomNumber++;
_root.attachMovie("friendly_dead", "friendly_dead" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
friendlyWalking.splice(i, 1);
UnitframeNumber.splice(i, 1);
UnitHealth.splice(i, 1);
}
i--;
}
}
function moveFriendlyLeft() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x - 5;
i--;
}
}
function moveFriendlyRight() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x + 5;
i--;
}
}
function moveEnemyLeft() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x - 5;
i--;
}
}
function moveEnemyRight() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x + 5;
i--;
}
}
function restrictFirst() {
if (is_attacking < 0) {
is_attacking = 0;
attacking = false;
}
}
function restrictSecond() {
if (is_attacking2 < 0) {
is_attacking2 = 0;
attacking = false;
}
}
function restrictThird() {
if (is_attacking3 < 0) {
is_attacking3 = 0;
attacking = false;
}
}
function playerJump() {
yspeed = yspeed + down_force;
_root.player._y = _root.player._y + yspeed;
}
function playerOnGround() {
if (player._y > 365) {
_root.player._y = 365;
airCombo = 3;
yspeed = 0;
jumping = false;
jump_power = 15;
down_force = 0;
}
}
function addComboPoint() {
if (mouseDown_) {
if ((is_attacking > 0) && (is_attacking < 6)) {
combo = 1;
}
if ((is_attacking2 > 0) && (is_attacking2 < 6)) {
combo = 2;
}
}
}
function hover() {
if (attacking) {
down_force = 0;
yspeed = 0;
} else {
down_force = 1;
}
}
function playerCombo1() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 0) {
is_attacking = is_attacking - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack1");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack1");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
}
}
}
}
}
}
}
function playerCombo2() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 1) {
is_attacking = 0;
is_attacking2 = is_attacking2 - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack2");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack2");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
}
}
}
}
}
}
}
function playerCombo3() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 2) {
is_attacking2 = 0;
is_attacking3 = is_attacking3 - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack3");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack3");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
combo = 0;
}
}
}
}
}
}
}
function beingHit() {
if (taking_damage) {
ouch = ouch - 1;
if (!jumping) {
player.gotoAndPlay("hitGround");
} else {
player.gotoAndPlay("hitAir");
}
if (ouch == 0) {
hit_sound.start();
taking_damage = false;
ouch = 3;
}
}
}
function correct_player_hit_placement() {
if (going_right) {
_root.player_hit._xscale = 100;
}
if (going_left) {
_root.player_hit._xscale = -100;
}
}
function playerMovements() {
if (!taking_damage) {
if (!attacking) {
if (Key.isDown(38) or Key.isDown(87)) {
yspeed = yspeed - jump_power;
jumping = true;
jump_power = 0;
down_force = 1;
player.gotoAndStop("jump");
}
if (Key.isDown(39) or Key.isDown(68)) {
going_left = false;
going_right = true;
_root.player._xscale = 100;
_root.player._x = _root.player._x + playerSpeed;
if (!jumping) {
player.gotoAndStop("running");
}
} else if (Key.isDown(37) or Key.isDown(65)) {
going_left = true;
going_right = false;
_root.player._xscale = -100;
_root.player._x = _root.player._x - playerSpeed;
if (!jumping) {
player.gotoAndStop("running");
}
} else if (!jumping) {
player.gotoAndStop("idle");
}
}
}
}
function Bounds() {
if (player._x > 380) {
if (_root.grass._x > -2335) {
moveFriendlyLeft();
moveEnemyLeft();
enemyGuardian._x = enemyGuardian._x - 15;
_root.deadE_._x = _root.deadE_._x - 15;
_root.player._x = 380;
_root.grass._x = _root.grass._x - 15;
_root.city._x = _root.city._x - 12;
_root.sky._x = _root.sky._x - 1;
_root.mountains._x = _root.mountains._x - 2;
} else {
_root.player._x = 380;
if (!jumping) {
_root.player.gotoAndStop("idle");
} else {
_root.player.gotoAndStop("jump");
}
enemyGuardian._x = enemyGuardian._x - 0;
_root.deadE_._x = _root.deadE_._x - 0;
_root.grass._x = _root.grass._x - 0;
_root.city._x = _root.city._x - 0;
_root.sky._x = _root.sky._x - 0;
_root.mountains._x = _root.mountains._x - 0;
}
} else if (player._x < 150) {
if (_root.grass._x < -20) {
moveFriendlyRight();
moveEnemyRight();
enemyGuardian._x = enemyGuardian._x + 15;
_root.deadE_._x = _root.deadE_._x + 15;
_root.player._x = 150;
_root.grass._x = _root.grass._x + 15;
_root.city._x = _root.city._x + 12;
_root.sky._x = _root.sky._x + 1;
_root.mountains._x = _root.mountains._x + 2;
} else {
_root.player._x = 150;
if (!jumping) {
_root.player.gotoAndStop("idle");
} else {
_root.player.gotoAndStop("jump");
}
enemyGuardian._x = enemyGuardian._x + 0;
_root.deadE_._x = _root.deadE_._x + 0;
_root.grass._x = _root.grass._x + 0;
_root.city._x = _root.city._x + 0;
_root.sky._x = _root.sky._x + 0;
_root.mountains._x = _root.mountains._x + 0;
}
}
}
function attatchUnit() {
if (exp > 9) {
if (maxUnits < 11) {
if (releaseUnit) {
releaseTimer = releaseTimer - 1;
}
if (releaseTimer == 0) {
releaseUnit = false;
releaseTimer = 90;
exp = exp - 10;
maxUnits++;
randomNumber++;
friendlyUnit = attachMovie("friendly", "friendly" + randomNumber, _root.getNextHighestDepth(), {_x:-300, _y:360});
hold_friendlyUnit.push(friendlyUnit);
friendlyWalking.push(true);
UnitframeNumber.push(0);
UnitHealth.push(15);
}
}
}
}
function blockMinusExp() {
if (exp < 0) {
exp = 0;
}
}
function pause_game() {
if (!Pause) {
if (Key.isDown(80)) {
Mouse.show();
Pause = true;
_root.attachMovie("pauseScreen", "pauseScreen", _root.getNextHighestDepth(), {_x:0, _y:0});
}
}
}
function unpause_game() {
if (Pause) {
if (Key.isDown(85)) {
Mouse.hide();
Pause = false;
pauseScreen.removeMovieClip();
}
}
}
function gameOver() {
if (playerHealth < 1) {
removefriendlyWalking();
removeenemyFacingRight();
removeenemyWalking();
removeUnitHealth();
removeenemyHealth();
removeUnitframeNumber();
removeframeNumber();
removehold_enemyUnit();
removehold_friendlyUnit();
player.removeMovieClip();
enemyGuardian.removeMovieClip();
stopAllSounds();
warning.removeMovieClip();
gotoAndStop ("game_over2");
}
}
function gameOverVictory() {
if (guardianDead) {
if (maxEnemies == 0) {
level = 3;
removefriendlyWalking();
removeenemyFacingRight();
removeenemyWalking();
removeUnitHealth();
removeenemyHealth();
removeUnitframeNumber();
removeframeNumber();
removehold_enemyUnit();
removehold_friendlyUnit();
warning.removeMovieClip();
delay++;
if (delay == 96) {
player.removeMovieClip();
enemyGuardian.removeMovieClip();
stopAllSounds();
gotoAndStop ("game_over_victory2");
}
}
}
}
function removehold_friendlyUnit() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
i--;
}
}
function removehold_enemyUnit() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i].removeMovieClip();
hold_enemyUnit.splice(i, 1);
i--;
}
}
function removeframeNumber() {
i = frameNumber.length - 1;
while (i >= 0) {
frameNumber[i].removeMovieClip();
frameNumber.splice(i, 1);
i--;
}
}
function removeUnitframeNumber() {
i = UnitframeNumber.length - 1;
while (i >= 0) {
UnitframeNumber[i].removeMovieClip();
UnitframeNumber.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removeUnitHealth() {
i = UnitHealth.length - 1;
while (i >= 0) {
UnitHealth[i].removeMovieClip();
UnitHealth.splice(i, 1);
i--;
}
}
function removeenemyWalking() {
i = enemyWalking.length - 1;
while (i >= 0) {
enemyWalking[i].removeMovieClip();
enemyWalking.splice(i, 1);
i--;
}
}
function removeenemyFacingRight() {
i = enemyFacingRight.length - 1;
while (i >= 0) {
enemyFacingRight[i].removeMovieClip();
enemyFacingRight.splice(i, 1);
i--;
}
}
function removefriendlyWalking() {
i = friendlyWalking.length - 1;
while (i >= 0) {
friendlyWalking[i].removeMovieClip();
friendlyWalking.splice(i, 1);
i--;
}
}
function moreExpNeeded() {
if (exp < 10) {
needexp._x = -4.3;
needexp._y = 72.8;
} else {
needexp._x = -50;
needexp._y = -50;
}
}
function maximumUnits() {
if (maxUnits > 10) {
maximum_units._x = 22.1;
maximum_units._y = 32.6;
} else {
maximum_units._x = -50;
maximum_units._y = -50;
}
}
function theMouseIssue() {
Mouse.hide();
endX = _root._xmouse;
endY = _root._ymouse;
Icon._x = Icon._x + (endX - Icon._x);
Icon._y = Icon._y + (endY - Icon._y);
if (mouseArea.hitTest(_root._xmouse, _root._ymouse, true)) {
Icon.gotoAndStop("one");
} else {
Icon.gotoAndStop("two");
}
}
function attachWarning() {
if (grass._x < -2335) {
onlyOnce++;
if (onlyOnce == 1) {
warningTwo.removeMovieClip();
}
}
}
function unitVsGuardianWaning() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(enemyGuardian)) {
if (hold_friendlyUnit[i]._x > (player._x + 700)) {
onceAgain++;
if (onceAgain == 1) {
warning.removeMovieClip();
_root.attachMovie("warningTwo", "warningTwo", _root.getNextHighestDepth(), {_x:140, _y:145});
}
} else {
onceAgain = 0;
}
}
i--;
}
}
stop();
onceAgain = 0;
onlyOnce = 0;
playonce = 0;
youAreFucked = false;
FSdeath_sound = new Sound();
FSdeath_sound.attachSound("FSdeath");
hit_sound = new Sound();
hit_sound.attachSound("hit");
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:340, _y:365});
_root.attachMovie("objective2", "objective1", _root.getNextHighestDepth(), {_x:65, _y:140});
_root.attachMovie("enemyUnitep", "enemyGuardian", _root.getNextHighestDepth(), {_x:2335, _y:365});
var hold_friendlyUnit = new Array();
var hold_enemyUnit = new Array();
var frameNumber = new Array();
var UnitframeNumber = new Array();
var enemyHealth = new Array();
var UnitHealth = new Array();
var enemyWalking = new Array();
var enemyFacingRight = new Array();
var friendlyWalking = new Array();
level = 2;
playerHealth = 500;
dino_speed = 150;
playerSpeed = 10;
down_force = 1;
yspeed = 0;
locked = false;
jumping = false;
jump_power = 15;
taking_damage = false;
going_left = false;
going_right = true;
attacking = false;
mouseDown_ = false;
releaseUnit = false;
enemyTakingDamage = false;
randomNumber = 0;
is_attacking = 0;
is_attacking2 = 0;
is_attacking3 = 0;
unitSpeed = 5;
comboTimer = 45;
combo = 0;
releaseTimer = 90;
runningRight = false;
runningLeft = false;
ouch = 3;
releaseEnemyUnitTimer = 260;
attachBlood = 0;
attachGuardianHit = 0;
guardianHealth = 35;
releaseGuardian = false;
maxUnits = 0;
maxEnemies = 0;
exp = 0;
delay = 0;
Pause = false;
guardianDead = false;
_root.onMouseUp = function () {
mouseDown_ = false;
down_force = 1;
};
_root.onMouseDown = function () {
mouseDown_ = true;
if (!add_unit1.hitTest(_root._xmouse, _root._ymouse, true)) {
attacking = true;
if (combo == 0) {
if (is_attacking == 0) {
is_attacking = 20;
}
}
if (combo == 1) {
if (is_attacking2 == 0) {
is_attacking2 = 11;
}
}
if (combo == 2) {
if (is_attacking3 == 0) {
is_attacking3 = 11;
}
}
}
};
add_unit1.onEnterFrame = function () {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
add_unit1.gotoAndStop("down");
if (mouseDown_) {
releaseUnit = true;
}
} else {
add_unit1.gotoAndStop("up");
}
};
player.onEnterFrame = function () {
if (!Pause) {
blockMinusExp();
ereaseFriendlyUnit();
moveFriendlyLeft();
moveFriendlyRight();
attatchUnit();
playerCombo1();
playerCombo2();
playerCombo3();
playerMovements();
playerJump();
playerOnGround();
Bounds();
addComboPoint();
restrictFirst();
restrictSecond();
restrictThird();
beingHit();
hover();
correct_player_hit_placement();
attachEnemyUnit();
enemyActions();
facePlayer();
enemyMoveToPlayer();
helpUnitsVsEnemyUnits();
friendlyMove();
enemyGuardianMoveToPlayer();
playerVsGuardian();
murkFriendlyUnits();
randomAttack();
guardianFacePlayer();
bossKilled();
moreExpNeeded();
maximumUnits();
guardianWillKillYou();
theMouseIssue();
attachWarning();
unitVsGuardianWaning();
}
};
ppp.onEnterFrame = function () {
gameOverVictory();
gameOver();
pause_game();
unpause_game();
};
Frame 97
function guardianFacePlayer() {
if (!guardianDead) {
if (player._x > enemyGuardian._x) {
enemyGuardian._xscale = -100;
} else {
enemyGuardian._xscale = 100;
}
}
}
function guardianWillKillYou() {
if (youAreFucked) {
enemyGuardian.gotoAndStop("attack");
attachGuardianHit++;
if (attachGuardianHit == 20) {
_root.attachMovie("guardian_hit", "guardian_hit", _root.getNextHighestDepth(), {_x:enemyGuardian._x, _y:enemyGuardian._y});
attachGuardianHit = 0;
youAreFucked = false;
}
}
}
function randomAttack() {
if (!guardianDead) {
if (dino_speed == 5000) {
youAreFucked = true;
}
}
}
function bossKilled() {
if (AmountOfEnemies == 0) {
guardianDead = true;
}
}
function playerVsGuardian() {
if (!guardianDead) {
if (!youAreFucked) {
if (enemyGuardian.hitTest(_root.player_hit) or enemyGuardian.hitTest(_root.friendly_hit)) {
guardianHealth = guardianHealth - 1;
dino_speed = 5000;
} else {
dino_speed = 350;
}
if (enemyGuardian.hitTest(_root.player)) {
youAreFucked = true;
if (_root.player.hitTest(guardian_hit)) {
playerHealth = playerHealth - 15;
taking_damage = true;
}
} else {
enemyGuardian.gotoAndStop("walk");
}
}
}
}
function enemyGuardianMoveToPlayer() {
if (!guardianDead) {
if (grass._x < -4335) {
releaseGuardian = true;
}
if (releaseGuardian) {
endX = _root.player._x;
enemyGuardian._x = enemyGuardian._x + ((endX - enemyGuardian._x) / dino_speed);
}
}
}
function murkFriendlyUnits() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(guardian_hit)) {
UnitHealth[i] = UnitHealth[i] - 2;
}
if (hold_friendlyUnit[i].hitTest(enemy_hit)) {
UnitHealth[i] = UnitHealth[i] - 3;
}
if (UnitHealth[i] < 1) {
maxUnits--;
randomNumber++;
_root.attachMovie("friendly_dead", "friendly_dead" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
friendlyWalking.splice(i, 1);
UnitframeNumber.splice(i, 1);
UnitHealth.splice(i, 1);
}
i--;
}
}
function helpUnitsVsEnemyUnits() {
j = hold_enemyUnit.length - 1;
while (j >= 0) {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_enemyUnit[j].hitTest(hold_friendlyUnit[i]) or hold_friendlyUnit[i].hitTest(enemyGuardian)) {
friendlyWalking[i] = false;
hold_friendlyUnit[i].gotoAndStop("attack");
UnitframeNumber[i]++;
if (UnitframeNumber[i] == 9) {
randomNumber++;
friendly_hit = _root.attachMovie("unit_attack", "unit_attack" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
UnitframeNumber[i] = 0;
}
} else {
friendlyWalking[i] = true;
hold_friendlyUnit[i].gotoAndStop("walk");
}
i--;
}
j--;
}
}
function friendlyMove() {
if (!Pause) {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (friendlyWalking[i] == true) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x + (Math.round(Math.random() * 2) + 1);
}
i--;
}
}
}
function enemyMoveToPlayer() {
if (!Pause) {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (enemyWalking[i] == true) {
endX = _root.player._x;
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x + ((endX - hold_enemyUnit[i]._x) / 50);
}
i--;
}
}
}
function facePlayer() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (player._x > hold_enemyUnit[i]._x) {
enemyFacingRight[i] = true;
hold_enemyUnit[i]._xscale = -100;
} else {
enemyFacingRight[i] = false;
hold_enemyUnit[i]._xscale = 100;
}
i--;
}
}
function enemyActions() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (hold_enemyUnit[i].hitTest(_root.player_hit) or hold_enemyUnit[i].hitTest(friendly_hit)) {
enemyHealth[i] = enemyHealth[i] - 1;
enemyWalking[i] = false;
attachBlood++;
if (attachBlood == 10) {
hit_sound.start();
randomNumber++;
if (enemyFacingRight[i] == false) {
blood_ = _root.attachMovie("blood", "blood" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x - 28, _y:hold_enemyUnit[i]._y - 30});
} else {
blood_ = _root.attachMovie("blood", "blood" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x - 60, _y:hold_enemyUnit[i]._y - 30});
}
blood_._xscale = 50;
blood_._yscale = 50;
attachBlood = 0;
}
if (enemyHealth[i] < 1) {
AmountOfEnemies--;
exp = exp + 5;
score = score + 10;
randomNumber++;
deadE_ = _root.attachMovie("deadEb", "deadE" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x, _y:hold_enemyUnit[i]._y});
if (enemyFacingRight[i] == true) {
deadE_._xscale = -100;
}
maxEnemies--;
hold_enemyUnit[i].removeMovieClip();
hold_enemyUnit.splice(i, 1);
frameNumber.splice(i, 1);
enemyHealth.splice(i, 1);
enemyWalking.splice(i, 1);
enemyFacingRight.splice(i, 1);
}
}
if (hold_enemyUnit[i].hitTest(_root.player)) {
frameNumber[i]++;
if (frameNumber[i] == 18) {
if (enemyFacingRight[i] == false) {
_root.attachMovie("enemy_hit", "enemy_hit", _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x, _y:hold_enemyUnit[i]._y});
} else {
_root.attachMovie("enemy_hit", "enemy_hit", _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x + 80, _y:hold_enemyUnit[i]._y});
}
}
enemyWalking[i] = false;
hold_enemyUnit[i].gotoAndStop("attack");
if (_root.player.hitTest(enemy_hit)) {
playerHealth--;
taking_damage = true;
frameNumber[i] = 0;
}
} else {
frameNumber[i] = 0;
enemyWalking[i] = true;
hold_enemyUnit[i].gotoAndStop("walk");
}
i--;
}
}
function attachEnemyUnit() {
if (!Pause) {
if (!guardianDead) {
if (maxEnemies < 11) {
releaseEnemyUnitTimer = releaseEnemyUnitTimer - 1;
if (releaseEnemyUnitTimer == 0) {
maxEnemies++;
dir = ["left", "right"];
randNum = random(2);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomNumber++;
Enemy_Unit = _root.attachMovie("alt_enemy", "enemyUnit" + randomNumber, _root.getNextHighestDepth(), {_x:-20, _y:355});
hold_enemyUnit.push(Enemy_Unit);
frameNumber.push(0);
enemyHealth.push(10);
enemyWalking.push(true);
enemyFacingRight.push(false);
break;
case "right" :
randomNumber++;
Enemy_Unit = _root.attachMovie("alt_enemy", "enemyUnit" + randomNumber, _root.getNextHighestDepth(), {_x:600, _y:355});
hold_enemyUnit.push(Enemy_Unit);
frameNumber.push(0);
enemyHealth.push(10);
enemyWalking.push(true);
enemyFacingRight.push(false);
}
releaseEnemyUnitTimer = 32;
}
}
}
}
}
function ereaseFriendlyUnit() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i]._x > (player._x + 1000)) {
maxUnits--;
randomNumber++;
_root.attachMovie("friendly_dead", "friendly_dead" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
friendlyWalking.splice(i, 1);
UnitframeNumber.splice(i, 1);
UnitHealth.splice(i, 1);
}
i--;
}
}
function moveFriendlyLeft() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x - 5;
i--;
}
}
function moveFriendlyRight() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x + 5;
i--;
}
}
function moveEnemyLeft() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x - 5;
i--;
}
}
function moveEnemyRight() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x + 5;
i--;
}
}
function restrictFirst() {
if (is_attacking < 0) {
is_attacking = 0;
attacking = false;
}
}
function restrictSecond() {
if (is_attacking2 < 0) {
is_attacking2 = 0;
attacking = false;
}
}
function restrictThird() {
if (is_attacking3 < 0) {
is_attacking3 = 0;
attacking = false;
}
}
function playerJump() {
yspeed = yspeed + down_force;
_root.player._y = _root.player._y + yspeed;
}
function playerOnGround() {
if (player._y > 365) {
_root.player._y = 365;
airCombo = 3;
yspeed = 0;
jumping = false;
jump_power = 15;
down_force = 0;
}
}
function addComboPoint() {
if (mouseDown_) {
if ((is_attacking > 0) && (is_attacking < 6)) {
combo = 1;
}
if ((is_attacking2 > 0) && (is_attacking2 < 6)) {
combo = 2;
}
}
}
function hover() {
if (attacking) {
down_force = 0;
yspeed = 0;
} else {
down_force = 1;
}
}
function playerCombo1() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 0) {
is_attacking = is_attacking - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack1");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack1");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
}
}
}
}
}
}
}
function playerCombo2() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 1) {
is_attacking = 0;
is_attacking2 = is_attacking2 - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack2");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack2");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
}
}
}
}
}
}
}
function playerCombo3() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 2) {
is_attacking2 = 0;
is_attacking3 = is_attacking3 - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack3");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack3");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
combo = 0;
}
}
}
}
}
}
}
function beingHit() {
if (taking_damage) {
ouch = ouch - 1;
if (!jumping) {
player.gotoAndPlay("hitGround");
} else {
player.gotoAndPlay("hitAir");
}
if (ouch == 0) {
hit_sound.start();
taking_damage = false;
ouch = 3;
}
}
}
function correct_player_hit_placement() {
if (going_right) {
_root.player_hit._xscale = 100;
}
if (going_left) {
_root.player_hit._xscale = -100;
}
}
function playerMovements() {
if (!taking_damage) {
if (!attacking) {
if (Key.isDown(38) or Key.isDown(87)) {
yspeed = yspeed - jump_power;
jumping = true;
jump_power = 0;
down_force = 1;
player.gotoAndStop("jump");
}
if (Key.isDown(39) or Key.isDown(68)) {
going_left = false;
going_right = true;
_root.player._xscale = 100;
_root.player._x = _root.player._x + playerSpeed;
if (!jumping) {
player.gotoAndStop("running");
}
} else if (Key.isDown(37) or Key.isDown(65)) {
going_left = true;
going_right = false;
_root.player._xscale = -100;
_root.player._x = _root.player._x - playerSpeed;
if (!jumping) {
player.gotoAndStop("running");
}
} else if (!jumping) {
player.gotoAndStop("idle");
}
}
}
}
function Bounds() {
if (player._x > 380) {
if (_root.grass._x > -2335) {
moveFriendlyLeft();
moveEnemyLeft();
enemyGuardian._x = enemyGuardian._x - 15;
_root.deadE_._x = _root.deadE_._x - 15;
_root.player._x = 380;
_root.grass._x = _root.grass._x - 15;
_root.city._x = _root.city._x - 12;
_root.sky._x = _root.sky._x - 1;
_root.mountains._x = _root.mountains._x - 2;
} else {
_root.player._x = 380;
if (!jumping) {
_root.player.gotoAndStop("idle");
} else {
_root.player.gotoAndStop("jump");
}
enemyGuardian._x = enemyGuardian._x - 0;
_root.deadE_._x = _root.deadE_._x - 0;
_root.grass._x = _root.grass._x - 0;
_root.city._x = _root.city._x - 0;
_root.sky._x = _root.sky._x - 0;
_root.mountains._x = _root.mountains._x - 0;
}
} else if (player._x < 150) {
if (_root.grass._x < -20) {
moveFriendlyRight();
moveEnemyRight();
enemyGuardian._x = enemyGuardian._x + 15;
_root.deadE_._x = _root.deadE_._x + 15;
_root.player._x = 150;
_root.grass._x = _root.grass._x + 15;
_root.city._x = _root.city._x + 12;
_root.sky._x = _root.sky._x + 1;
_root.mountains._x = _root.mountains._x + 2;
} else {
_root.player._x = 150;
if (!jumping) {
_root.player.gotoAndStop("idle");
} else {
_root.player.gotoAndStop("jump");
}
enemyGuardian._x = enemyGuardian._x + 0;
_root.deadE_._x = _root.deadE_._x + 0;
_root.grass._x = _root.grass._x + 0;
_root.city._x = _root.city._x + 0;
_root.sky._x = _root.sky._x + 0;
_root.mountains._x = _root.mountains._x + 0;
}
}
}
function attatchUnit() {
if (exp > 9) {
if (maxUnits < 11) {
if (releaseUnit) {
releaseTimer = releaseTimer - 1;
}
if (releaseTimer == 0) {
releaseUnit = false;
releaseTimer = 90;
exp = exp - 10;
maxUnits++;
randomNumber++;
friendlyUnit = attachMovie("friendly", "friendly" + randomNumber, _root.getNextHighestDepth(), {_x:-300, _y:360});
hold_friendlyUnit.push(friendlyUnit);
friendlyWalking.push(true);
UnitframeNumber.push(0);
UnitHealth.push(15);
}
}
}
}
function blockMinusExp() {
if (exp < 0) {
exp = 0;
}
}
function pause_game() {
if (!Pause) {
if (Key.isDown(80)) {
Mouse.show();
Pause = true;
_root.attachMovie("pauseScreen", "pauseScreen", _root.getNextHighestDepth(), {_x:0, _y:0});
}
}
}
function unpause_game() {
if (Pause) {
if (Key.isDown(85)) {
Mouse.hide();
Pause = false;
pauseScreen.removeMovieClip();
}
}
}
function gameOver() {
if (playerHealth < 1) {
removefriendlyWalking();
removeenemyFacingRight();
removeenemyWalking();
removeUnitHealth();
removeenemyHealth();
removeUnitframeNumber();
removeframeNumber();
removehold_enemyUnit();
removehold_friendlyUnit();
player.removeMovieClip();
enemyGuardian.removeMovieClip();
stopAllSounds();
warning.removeMovieClip();
gotoAndStop ("game_over3");
}
}
function gameOverVictory() {
if (guardianDead) {
if (maxEnemies == 0) {
level = 4;
removefriendlyWalking();
removeenemyFacingRight();
removeenemyWalking();
removeUnitHealth();
removeenemyHealth();
removeUnitframeNumber();
removeframeNumber();
removehold_enemyUnit();
removehold_friendlyUnit();
warning.removeMovieClip();
delay++;
if (delay == 96) {
player.removeMovieClip();
enemyGuardian.removeMovieClip();
stopAllSounds();
gotoAndStop ("game_over_victory3");
}
}
}
}
function removehold_friendlyUnit() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
i--;
}
}
function removehold_enemyUnit() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i].removeMovieClip();
hold_enemyUnit.splice(i, 1);
i--;
}
}
function removeframeNumber() {
i = frameNumber.length - 1;
while (i >= 0) {
frameNumber[i].removeMovieClip();
frameNumber.splice(i, 1);
i--;
}
}
function removeUnitframeNumber() {
i = UnitframeNumber.length - 1;
while (i >= 0) {
UnitframeNumber[i].removeMovieClip();
UnitframeNumber.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removeUnitHealth() {
i = UnitHealth.length - 1;
while (i >= 0) {
UnitHealth[i].removeMovieClip();
UnitHealth.splice(i, 1);
i--;
}
}
function removeenemyWalking() {
i = enemyWalking.length - 1;
while (i >= 0) {
enemyWalking[i].removeMovieClip();
enemyWalking.splice(i, 1);
i--;
}
}
function removeenemyFacingRight() {
i = enemyFacingRight.length - 1;
while (i >= 0) {
enemyFacingRight[i].removeMovieClip();
enemyFacingRight.splice(i, 1);
i--;
}
}
function removefriendlyWalking() {
i = friendlyWalking.length - 1;
while (i >= 0) {
friendlyWalking[i].removeMovieClip();
friendlyWalking.splice(i, 1);
i--;
}
}
function moreExpNeeded() {
if (exp < 10) {
needexp._x = -4.3;
needexp._y = 72.8;
} else {
needexp._x = -50;
needexp._y = -50;
}
}
function maximumUnits() {
if (maxUnits > 10) {
maximum_units._x = 22.1;
maximum_units._y = 32.6;
} else {
maximum_units._x = -50;
maximum_units._y = -50;
}
}
function theMouseIssue() {
Mouse.hide();
endX = _root._xmouse;
endY = _root._ymouse;
Icon._x = Icon._x + (endX - Icon._x);
Icon._y = Icon._y + (endY - Icon._y);
if (mouseArea.hitTest(_root._xmouse, _root._ymouse, true)) {
Icon.gotoAndStop("one");
} else {
Icon.gotoAndStop("two");
}
}
function attachWarning() {
if (grass._x < -2335) {
onlyOnce++;
if (onlyOnce == 1) {
warningTwo.removeMovieClip();
}
}
}
function unitVsGuardianWaning() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(enemyGuardian)) {
if (hold_friendlyUnit[i]._x > (player._x + 700)) {
onceAgain++;
if (onceAgain == 1) {
warning.removeMovieClip();
_root.attachMovie("warningTwo", "warningTwo", _root.getNextHighestDepth(), {_x:140, _y:145});
}
} else {
onceAgain = 0;
}
}
i--;
}
}
stop();
AmountOfEnemies = 300;
onceAgain = 0;
onlyOnce = 0;
playonce = 0;
youAreFucked = false;
FSdeath_sound = new Sound();
FSdeath_sound.attachSound("FSdeath");
hit_sound = new Sound();
hit_sound.attachSound("hit");
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:25, _y:365});
_root.attachMovie("objective3", "objective1", _root.getNextHighestDepth(), {_x:65, _y:140});
var hold_friendlyUnit = new Array();
var hold_enemyUnit = new Array();
var frameNumber = new Array();
var UnitframeNumber = new Array();
var enemyHealth = new Array();
var UnitHealth = new Array();
var enemyWalking = new Array();
var enemyFacingRight = new Array();
var friendlyWalking = new Array();
level = 3;
playerHealth = 500;
dino_speed = 350;
playerSpeed = 10;
down_force = 1;
yspeed = 0;
locked = false;
jumping = false;
jump_power = 15;
taking_damage = false;
going_left = false;
going_right = true;
attacking = false;
mouseDown_ = false;
releaseUnit = false;
enemyTakingDamage = false;
randomNumber = 0;
is_attacking = 0;
is_attacking2 = 0;
is_attacking3 = 0;
unitSpeed = 5;
comboTimer = 45;
combo = 0;
releaseTimer = 90;
runningRight = false;
runningLeft = false;
ouch = 3;
releaseEnemyUnitTimer = 560;
attachBlood = 0;
attachGuardianHit = 0;
guardianHealth = 150;
releaseGuardian = false;
maxUnits = 0;
maxEnemies = 0;
exp = 0;
delay = 0;
Pause = false;
guardianDead = false;
_root.onMouseUp = function () {
mouseDown_ = false;
down_force = 1;
};
_root.onMouseDown = function () {
mouseDown_ = true;
if (!add_unit1.hitTest(_root._xmouse, _root._ymouse, true)) {
attacking = true;
if (combo == 0) {
if (is_attacking == 0) {
is_attacking = 20;
}
}
if (combo == 1) {
if (is_attacking2 == 0) {
is_attacking2 = 11;
}
}
if (combo == 2) {
if (is_attacking3 == 0) {
is_attacking3 = 11;
}
}
}
};
add_unit1.onEnterFrame = function () {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
add_unit1.gotoAndStop("down");
if (mouseDown_) {
releaseUnit = true;
}
} else {
add_unit1.gotoAndStop("up");
}
};
player.onEnterFrame = function () {
if (!Pause) {
blockMinusExp();
ereaseFriendlyUnit();
moveFriendlyLeft();
moveFriendlyRight();
attatchUnit();
playerCombo1();
playerCombo2();
playerCombo3();
playerMovements();
playerJump();
playerOnGround();
Bounds();
addComboPoint();
restrictFirst();
restrictSecond();
restrictThird();
beingHit();
hover();
correct_player_hit_placement();
attachEnemyUnit();
enemyActions();
facePlayer();
enemyMoveToPlayer();
helpUnitsVsEnemyUnits();
friendlyMove();
enemyGuardianMoveToPlayer();
playerVsGuardian();
murkFriendlyUnits();
randomAttack();
guardianFacePlayer();
bossKilled();
moreExpNeeded();
maximumUnits();
guardianWillKillYou();
theMouseIssue();
attachWarning();
unitVsGuardianWaning();
if (AmountOfEnemies < 0) {
AmountOfEnemies = 0;
}
}
};
ppp.onEnterFrame = function () {
gameOverVictory();
gameOver();
pause_game();
unpause_game();
};
Frame 98
function guardianFacePlayer() {
if (!guardianDead) {
if (player._x > enemyGuardian._x) {
enemyGuardian._xscale = -100;
} else {
enemyGuardian._xscale = 100;
}
}
}
function guardianWillKillYou() {
if (youAreFucked) {
enemyGuardian.gotoAndStop("attack");
attachGuardianHit++;
if (attachGuardianHit == 20) {
_root.attachMovie("guardian_hit", "guardian_hit", _root.getNextHighestDepth(), {_x:enemyGuardian._x, _y:enemyGuardian._y});
attachGuardianHit = 0;
youAreFucked = false;
}
}
}
function randomAttack() {
if (!guardianDead) {
if (dino_speed == 450) {
youAreFucked = true;
}
}
}
function bossKilled() {
if (guardianHealth < 1) {
guardianDead = true;
playonce++;
if (playonce == 1) {
score = score + 500;
FSdeath_sound.start();
}
enemyGuardian.gotoAndStop("dead");
}
}
function playerVsGuardian() {
if (!guardianDead) {
if (!youAreFucked) {
if (enemyGuardian.hitTest(_root.player_hit) or enemyGuardian.hitTest(_root.friendly_hit)) {
guardianHealth = guardianHealth - 1;
dino_speed = 450;
} else {
dino_speed = 350;
}
if (enemyGuardian.hitTest(_root.player)) {
youAreFucked = true;
if (_root.player.hitTest(guardian_hit)) {
playerHealth = playerHealth - 15;
taking_damage = true;
}
} else {
enemyGuardian.gotoAndStop("walk");
}
}
}
}
function enemyGuardianMoveToPlayer() {
if (!guardianDead) {
if (grass._x < -4335) {
releaseGuardian = true;
}
if (releaseGuardian) {
endX = _root.player._x;
enemyGuardian._x = enemyGuardian._x + ((endX - enemyGuardian._x) / dino_speed);
}
}
}
function murkFriendlyUnits() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(guardian_hit)) {
UnitHealth[i] = UnitHealth[i] - 2;
}
if (hold_friendlyUnit[i].hitTest(enemy_hit)) {
UnitHealth[i] = UnitHealth[i] - 3;
}
if (UnitHealth[i] < 1) {
maxUnits--;
randomNumber++;
_root.attachMovie("friendly_dead", "friendly_dead" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
friendlyWalking.splice(i, 1);
UnitframeNumber.splice(i, 1);
UnitHealth.splice(i, 1);
}
i--;
}
}
function helpUnitsVsEnemyUnits() {
j = hold_enemyUnit.length - 1;
while (j >= 0) {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_enemyUnit[j].hitTest(hold_friendlyUnit[i]) or hold_friendlyUnit[i].hitTest(enemyGuardian)) {
friendlyWalking[i] = false;
hold_friendlyUnit[i].gotoAndStop("attack");
UnitframeNumber[i]++;
if (UnitframeNumber[i] == 9) {
randomNumber++;
friendly_hit = _root.attachMovie("unit_attack", "unit_attack" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
UnitframeNumber[i] = 0;
}
} else {
friendlyWalking[i] = true;
hold_friendlyUnit[i].gotoAndStop("walk");
}
i--;
}
j--;
}
}
function friendlyMove() {
if (!Pause) {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (friendlyWalking[i] == true) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x + (Math.round(Math.random() * 2) + 1);
}
i--;
}
}
}
function enemyMoveToPlayer() {
if (!Pause) {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (enemyWalking[i] == true) {
endX = _root.player._x;
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x + ((endX - hold_enemyUnit[i]._x) / 50);
}
i--;
}
}
}
function facePlayer() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (player._x > hold_enemyUnit[i]._x) {
enemyFacingRight[i] = true;
hold_enemyUnit[i]._xscale = -100;
} else {
enemyFacingRight[i] = false;
hold_enemyUnit[i]._xscale = 100;
}
i--;
}
}
function enemyActions() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (hold_enemyUnit[i].hitTest(_root.player_hit) or hold_enemyUnit[i].hitTest(friendly_hit)) {
enemyHealth[i] = enemyHealth[i] - 1;
enemyWalking[i] = false;
attachBlood++;
if (attachBlood == 10) {
hit_sound.start();
randomNumber++;
if (enemyFacingRight[i] == false) {
blood_ = _root.attachMovie("blood", "blood" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x - 28, _y:hold_enemyUnit[i]._y - 30});
} else {
blood_ = _root.attachMovie("blood", "blood" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x - 60, _y:hold_enemyUnit[i]._y - 30});
}
blood_._xscale = 50;
blood_._yscale = 50;
attachBlood = 0;
}
if (enemyHealth[i] < 1) {
exp = exp + 5;
score = score + 10;
randomNumber++;
deadE_ = _root.attachMovie("deadE", "deadE" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x, _y:hold_enemyUnit[i]._y});
if (enemyFacingRight[i] == true) {
deadE_._xscale = -100;
}
maxEnemies--;
hold_enemyUnit[i].removeMovieClip();
hold_enemyUnit.splice(i, 1);
frameNumber.splice(i, 1);
enemyHealth.splice(i, 1);
enemyWalking.splice(i, 1);
enemyFacingRight.splice(i, 1);
}
}
if (hold_enemyUnit[i].hitTest(_root.player)) {
frameNumber[i]++;
if (frameNumber[i] == 18) {
if (enemyFacingRight[i] == false) {
_root.attachMovie("enemy_hit", "enemy_hit", _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x, _y:hold_enemyUnit[i]._y});
} else {
_root.attachMovie("enemy_hit", "enemy_hit", _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x + 80, _y:hold_enemyUnit[i]._y});
}
}
enemyWalking[i] = false;
hold_enemyUnit[i].gotoAndStop("attack");
if (_root.player.hitTest(enemy_hit)) {
playerHealth--;
taking_damage = true;
frameNumber[i] = 0;
}
} else {
frameNumber[i] = 0;
enemyWalking[i] = true;
hold_enemyUnit[i].gotoAndStop("walk");
}
i--;
}
}
function attachEnemyUnit() {
if (!Pause) {
if (!guardianDead) {
if (maxEnemies < 11) {
releaseEnemyUnitTimer = releaseEnemyUnitTimer - 1;
if (releaseEnemyUnitTimer == 0) {
maxEnemies++;
randomNumber++;
Enemy_Unit = _root.attachMovie("enemyUnit", "enemyUnit" + randomNumber, _root.getNextHighestDepth(), {_x:600, _y:355});
hold_enemyUnit.push(Enemy_Unit);
frameNumber.push(0);
enemyHealth.push(15);
enemyWalking.push(true);
enemyFacingRight.push(false);
releaseEnemyUnitTimer = 64;
}
}
}
}
}
function ereaseFriendlyUnit() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i]._x > 9000) {
maxUnits--;
randomNumber++;
_root.attachMovie("friendly_dead", "friendly_dead" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
friendlyWalking.splice(i, 1);
UnitframeNumber.splice(i, 1);
UnitHealth.splice(i, 1);
}
i--;
}
}
function moveFriendlyLeft() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x - 5;
i--;
}
}
function moveFriendlyRight() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x + 5;
i--;
}
}
function moveEnemyLeft() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x - 5;
i--;
}
}
function moveEnemyRight() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x + 5;
i--;
}
}
function restrictFirst() {
if (is_attacking < 0) {
is_attacking = 0;
attacking = false;
}
}
function restrictSecond() {
if (is_attacking2 < 0) {
is_attacking2 = 0;
attacking = false;
}
}
function restrictThird() {
if (is_attacking3 < 0) {
is_attacking3 = 0;
attacking = false;
}
}
function playerJump() {
yspeed = yspeed + down_force;
_root.player._y = _root.player._y + yspeed;
}
function playerOnGround() {
if (player._y > 365) {
_root.player._y = 365;
airCombo = 3;
yspeed = 0;
jumping = false;
jump_power = 15;
down_force = 0;
}
}
function addComboPoint() {
if (mouseDown_) {
if ((is_attacking > 0) && (is_attacking < 6)) {
combo = 1;
}
if ((is_attacking2 > 0) && (is_attacking2 < 6)) {
combo = 2;
}
}
}
function hover() {
if (attacking) {
down_force = 0;
yspeed = 0;
} else {
down_force = 1;
}
}
function playerCombo1() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 0) {
is_attacking = is_attacking - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack1");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack1");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
}
}
}
}
}
}
}
function playerCombo2() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 1) {
is_attacking = 0;
is_attacking2 = is_attacking2 - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack2");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack2");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
}
}
}
}
}
}
}
function playerCombo3() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 2) {
is_attacking2 = 0;
is_attacking3 = is_attacking3 - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack3");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack3");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
combo = 0;
}
}
}
}
}
}
}
function beingHit() {
if (taking_damage) {
ouch = ouch - 1;
if (!jumping) {
player.gotoAndPlay("hitGround");
} else {
player.gotoAndPlay("hitAir");
}
if (ouch == 0) {
hit_sound.start();
taking_damage = false;
ouch = 3;
}
}
}
function correct_player_hit_placement() {
if (going_right) {
_root.player_hit._xscale = 100;
}
if (going_left) {
_root.player_hit._xscale = -100;
}
}
function playerMovements() {
if (!taking_damage) {
if (!attacking) {
if (Key.isDown(38) or Key.isDown(87)) {
yspeed = yspeed - jump_power;
jumping = true;
jump_power = 0;
down_force = 1;
player.gotoAndStop("jump");
}
if (Key.isDown(39) or Key.isDown(68)) {
going_left = false;
going_right = true;
_root.player._xscale = 100;
_root.player._x = _root.player._x + playerSpeed;
if (!jumping) {
player.gotoAndStop("running");
}
} else if (Key.isDown(37) or Key.isDown(65)) {
going_left = true;
going_right = false;
_root.player._xscale = -100;
_root.player._x = _root.player._x - playerSpeed;
if (!jumping) {
player.gotoAndStop("running");
}
} else if (!jumping) {
player.gotoAndStop("idle");
}
}
}
}
function Bounds() {
if (player._x > 380) {
if (_root.grass._x > -6450) {
moveFriendlyLeft();
moveEnemyLeft();
enemyGuardian._x = enemyGuardian._x - 15;
_root.deadE_._x = _root.deadE_._x - 15;
_root.player._x = 380;
_root.grass._x = _root.grass._x - 15;
_root.city._x = _root.city._x - 12;
_root.sky._x = _root.sky._x - 1;
_root.mountains._x = _root.mountains._x - 2;
} else {
_root.player._x = 380;
if (!jumping) {
_root.player.gotoAndStop("idle");
} else {
_root.player.gotoAndStop("jump");
}
enemyGuardian._x = enemyGuardian._x - 0;
_root.deadE_._x = _root.deadE_._x - 0;
_root.grass._x = _root.grass._x - 0;
_root.city._x = _root.city._x - 0;
_root.sky._x = _root.sky._x - 0;
_root.mountains._x = _root.mountains._x - 0;
}
} else if (player._x < 150) {
if (_root.grass._x < -20) {
moveFriendlyRight();
moveEnemyRight();
enemyGuardian._x = enemyGuardian._x + 15;
_root.deadE_._x = _root.deadE_._x + 15;
_root.player._x = 150;
_root.grass._x = _root.grass._x + 15;
_root.city._x = _root.city._x + 12;
_root.sky._x = _root.sky._x + 1;
_root.mountains._x = _root.mountains._x + 2;
} else {
_root.player._x = 150;
if (!jumping) {
_root.player.gotoAndStop("idle");
} else {
_root.player.gotoAndStop("jump");
}
enemyGuardian._x = enemyGuardian._x + 0;
_root.deadE_._x = _root.deadE_._x + 0;
_root.grass._x = _root.grass._x + 0;
_root.city._x = _root.city._x + 0;
_root.sky._x = _root.sky._x + 0;
_root.mountains._x = _root.mountains._x + 0;
}
}
}
function attatchUnit() {
if (exp > 9) {
if (maxUnits < 11) {
if (releaseUnit) {
releaseTimer = releaseTimer - 1;
}
if (releaseTimer == 0) {
releaseUnit = false;
releaseTimer = 90;
exp = exp - 10;
maxUnits++;
randomNumber++;
friendlyUnit = attachMovie("friendly", "friendly" + randomNumber, _root.getNextHighestDepth(), {_x:-300, _y:360});
hold_friendlyUnit.push(friendlyUnit);
friendlyWalking.push(true);
UnitframeNumber.push(0);
UnitHealth.push(15);
}
}
}
}
function blockMinusExp() {
if (exp < 0) {
exp = 0;
}
}
function pause_game() {
if (!Pause) {
if (Key.isDown(80)) {
Mouse.show();
Pause = true;
_root.attachMovie("pauseScreen", "pauseScreen", _root.getNextHighestDepth(), {_x:0, _y:0});
}
}
}
function unpause_game() {
if (Pause) {
if (Key.isDown(85)) {
Mouse.hide();
Pause = false;
pauseScreen.removeMovieClip();
}
}
}
function gameOver() {
if (playerHealth < 1) {
removefriendlyWalking();
removeenemyFacingRight();
removeenemyWalking();
removeUnitHealth();
removeenemyHealth();
removeUnitframeNumber();
removeframeNumber();
removehold_enemyUnit();
removehold_friendlyUnit();
player.removeMovieClip();
enemyGuardian.removeMovieClip();
stopAllSounds();
warning.removeMovieClip();
gotoAndStop ("game_over4");
}
}
function gameOverVictory() {
if (guardianDead) {
if (maxEnemies == 0) {
level = 5;
removefriendlyWalking();
removeenemyFacingRight();
removeenemyWalking();
removeUnitHealth();
removeenemyHealth();
removeUnitframeNumber();
removeframeNumber();
removehold_enemyUnit();
removehold_friendlyUnit();
warning.removeMovieClip();
delay++;
if (delay == 96) {
player.removeMovieClip();
enemyGuardian.removeMovieClip();
stopAllSounds();
gotoAndStop ("game_over_victory4");
}
}
}
}
function removehold_friendlyUnit() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
i--;
}
}
function removehold_enemyUnit() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i].removeMovieClip();
hold_enemyUnit.splice(i, 1);
i--;
}
}
function removeframeNumber() {
i = frameNumber.length - 1;
while (i >= 0) {
frameNumber[i].removeMovieClip();
frameNumber.splice(i, 1);
i--;
}
}
function removeUnitframeNumber() {
i = UnitframeNumber.length - 1;
while (i >= 0) {
UnitframeNumber[i].removeMovieClip();
UnitframeNumber.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removeUnitHealth() {
i = UnitHealth.length - 1;
while (i >= 0) {
UnitHealth[i].removeMovieClip();
UnitHealth.splice(i, 1);
i--;
}
}
function removeenemyWalking() {
i = enemyWalking.length - 1;
while (i >= 0) {
enemyWalking[i].removeMovieClip();
enemyWalking.splice(i, 1);
i--;
}
}
function removeenemyFacingRight() {
i = enemyFacingRight.length - 1;
while (i >= 0) {
enemyFacingRight[i].removeMovieClip();
enemyFacingRight.splice(i, 1);
i--;
}
}
function removefriendlyWalking() {
i = friendlyWalking.length - 1;
while (i >= 0) {
friendlyWalking[i].removeMovieClip();
friendlyWalking.splice(i, 1);
i--;
}
}
function moreExpNeeded() {
if (exp < 10) {
needexp._x = -4.3;
needexp._y = 72.8;
} else {
needexp._x = -50;
needexp._y = -50;
}
}
function maximumUnits() {
if (maxUnits > 10) {
maximum_units._x = 22.1;
maximum_units._y = 32.6;
} else {
maximum_units._x = -50;
maximum_units._y = -50;
}
}
function theMouseIssue() {
Mouse.hide();
endX = _root._xmouse;
endY = _root._ymouse;
Icon._x = Icon._x + (endX - Icon._x);
Icon._y = Icon._y + (endY - Icon._y);
if (mouseArea.hitTest(_root._xmouse, _root._ymouse, true)) {
Icon.gotoAndStop("one");
} else {
Icon.gotoAndStop("two");
}
}
function attachWarning() {
if (grass._x < -2335) {
onlyOnce++;
if (onlyOnce == 1) {
warningTwo.removeMovieClip();
_root.attachMovie("warning", "warning", _root.getNextHighestDepth(), {_x:140, _y:145});
}
}
}
function unitVsGuardianWaning() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(enemyGuardian)) {
if (hold_friendlyUnit[i]._x > (player._x + 700)) {
onceAgain++;
if (onceAgain == 1) {
warning.removeMovieClip();
_root.attachMovie("warningTwo", "warningTwo", _root.getNextHighestDepth(), {_x:140, _y:145});
}
}
}
i--;
}
}
stop();
onceAgain = 0;
onlyOnce = 0;
playonce = 0;
youAreFucked = false;
FSdeath_sound = new Sound();
FSdeath_sound.attachSound("FSdeath");
hit_sound = new Sound();
hit_sound.attachSound("hit");
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:25, _y:365});
_root.attachMovie("objective4", "objective1", _root.getNextHighestDepth(), {_x:65, _y:140});
_root.attachMovie("enemyGuardian", "enemyGuardian", _root.getNextHighestDepth(), {_x:5500, _y:15});
var hold_friendlyUnit = new Array();
var hold_enemyUnit = new Array();
var frameNumber = new Array();
var UnitframeNumber = new Array();
var enemyHealth = new Array();
var UnitHealth = new Array();
var enemyWalking = new Array();
var enemyFacingRight = new Array();
var friendlyWalking = new Array();
level = 4;
playerHealth = 500;
dino_speed = 350;
playerSpeed = 10;
down_force = 1;
yspeed = 0;
locked = false;
jumping = false;
jump_power = 15;
taking_damage = false;
going_left = false;
going_right = true;
attacking = false;
mouseDown_ = false;
releaseUnit = false;
enemyTakingDamage = false;
randomNumber = 0;
is_attacking = 0;
is_attacking2 = 0;
is_attacking3 = 0;
unitSpeed = 5;
comboTimer = 45;
combo = 0;
releaseTimer = 90;
runningRight = false;
runningLeft = false;
ouch = 3;
releaseEnemyUnitTimer = 260;
attachBlood = 0;
attachGuardianHit = 0;
guardianHealth = 75;
releaseGuardian = false;
maxUnits = 0;
maxEnemies = 0;
exp = 0;
delay = 0;
Pause = false;
guardianDead = false;
_root.onMouseUp = function () {
mouseDown_ = false;
down_force = 1;
};
_root.onMouseDown = function () {
mouseDown_ = true;
if (!add_unit1.hitTest(_root._xmouse, _root._ymouse, true)) {
attacking = true;
if (combo == 0) {
if (is_attacking == 0) {
is_attacking = 20;
}
}
if (combo == 1) {
if (is_attacking2 == 0) {
is_attacking2 = 11;
}
}
if (combo == 2) {
if (is_attacking3 == 0) {
is_attacking3 = 11;
}
}
}
};
add_unit1.onEnterFrame = function () {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
add_unit1.gotoAndStop("down");
if (mouseDown_) {
releaseUnit = true;
}
} else {
add_unit1.gotoAndStop("up");
}
};
player.onEnterFrame = function () {
if (!Pause) {
blockMinusExp();
ereaseFriendlyUnit();
moveFriendlyLeft();
moveFriendlyRight();
attatchUnit();
playerCombo1();
playerCombo2();
playerCombo3();
playerMovements();
playerJump();
playerOnGround();
Bounds();
addComboPoint();
restrictFirst();
restrictSecond();
restrictThird();
beingHit();
hover();
correct_player_hit_placement();
attachEnemyUnit();
enemyActions();
facePlayer();
enemyMoveToPlayer();
helpUnitsVsEnemyUnits();
friendlyMove();
enemyGuardianMoveToPlayer();
playerVsGuardian();
murkFriendlyUnits();
randomAttack();
guardianFacePlayer();
bossKilled();
moreExpNeeded();
maximumUnits();
guardianWillKillYou();
theMouseIssue();
attachWarning();
unitVsGuardianWaning();
}
};
ppp.onEnterFrame = function () {
gameOverVictory();
gameOver();
pause_game();
unpause_game();
};
Frame 99
function guardianFacePlayer() {
if (!guardianDead) {
if (player._x > enemyGuardian._x) {
enemyGuardian._xscale = -100;
} else {
enemyGuardian._xscale = 100;
}
}
}
function guardianWillKillYou() {
if (youAreFucked) {
enemyGuardian.gotoAndStop("attack");
attachGuardianHit++;
if (attachGuardianHit == 20) {
_root.attachMovie("guardian_hit", "guardian_hit", _root.getNextHighestDepth(), {_x:enemyGuardian._x, _y:enemyGuardian._y});
attachGuardianHit = 0;
youAreFucked = false;
}
}
}
function randomAttack() {
if (!guardianDead) {
if (dino_speed == 450) {
youAreFucked = true;
}
}
}
function bossKilled() {
if (guardianHealth < 1) {
guardianDead = true;
playonce++;
if (playonce == 1) {
score = score + 1000;
FSdeath_sound.start();
}
enemyGuardian.gotoAndStop("dead");
}
}
function playerVsGuardian() {
if (!guardianDead) {
if (!youAreFucked) {
if (enemyGuardian.hitTest(_root.player_hit) or enemyGuardian.hitTest(_root.friendly_hit)) {
guardianHealth = guardianHealth - 1;
dino_speed = 450;
} else {
dino_speed = 350;
}
if (enemyGuardian.hitTest(_root.player)) {
youAreFucked = true;
if (_root.player.hitTest(guardian_hit)) {
playerHealth = playerHealth - 15;
taking_damage = true;
}
} else {
enemyGuardian.gotoAndStop("walk");
}
}
}
}
function enemyGuardianMoveToPlayer() {
if (!guardianDead) {
if (grass._x < -4335) {
releaseGuardian = true;
}
if (releaseGuardian) {
endX = _root.player._x;
enemyGuardian._x = enemyGuardian._x + ((endX - enemyGuardian._x) / dino_speed);
}
}
}
function murkFriendlyUnits() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(guardian_hit)) {
UnitHealth[i] = UnitHealth[i] - 2;
}
if (hold_friendlyUnit[i].hitTest(enemy_hit)) {
UnitHealth[i] = UnitHealth[i] - 3;
}
if (UnitHealth[i] < 1) {
maxUnits--;
randomNumber++;
_root.attachMovie("friendly_dead_red", "friendly_dead" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
friendlyWalking.splice(i, 1);
UnitframeNumber.splice(i, 1);
UnitHealth.splice(i, 1);
}
i--;
}
}
function helpUnitsVsEnemyUnits() {
j = hold_enemyUnit.length - 1;
while (j >= 0) {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(enemyGuardian)) {
friendlyWalking[i] = false;
hold_friendlyUnit[i].gotoAndStop("attack");
UnitframeNumber[i]++;
if (UnitframeNumber[i] == 9) {
randomNumber++;
friendly_hit = _root.attachMovie("unit_attack", "unit_attack" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
UnitframeNumber[i] = 0;
}
} else {
friendlyWalking[i] = true;
hold_friendlyUnit[i].gotoAndStop("walk");
}
i--;
}
j--;
}
}
function friendlyMove() {
if (!Pause) {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (friendlyWalking[i] == true) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x + (Math.round(Math.random() * 2) + 1);
}
i--;
}
}
}
function enemyMoveToPlayer() {
if (!Pause) {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (enemyWalking[i] == true) {
endX = _root.player._x;
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x + ((endX - hold_enemyUnit[i]._x) / 50);
}
i--;
}
}
}
function facePlayer() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (player._x > hold_enemyUnit[i]._x) {
enemyFacingRight[i] = true;
hold_enemyUnit[i]._xscale = -100;
} else {
enemyFacingRight[i] = false;
hold_enemyUnit[i]._xscale = 100;
}
i--;
}
}
function enemyActions() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
if (hold_enemyUnit[i].hitTest(_root.player_hit) or hold_enemyUnit[i].hitTest(friendly_hit)) {
enemyHealth[i] = enemyHealth[i] - 1;
enemyWalking[i] = false;
attachBlood++;
if (attachBlood == 10) {
hit_sound.start();
randomNumber++;
if (enemyFacingRight[i] == false) {
blood_ = _root.attachMovie("blood", "blood" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x - 28, _y:hold_enemyUnit[i]._y - 30});
} else {
blood_ = _root.attachMovie("blood", "blood" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x - 60, _y:hold_enemyUnit[i]._y - 30});
}
blood_._xscale = 50;
blood_._yscale = 50;
attachBlood = 0;
}
if (enemyHealth[i] < 1) {
exp = exp + 5;
score = score + 20;
randomNumber++;
deadE_ = _root.attachMovie("deadEepic", "deadE" + randomNumber, _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x, _y:hold_enemyUnit[i]._y});
if (enemyFacingRight[i] == true) {
deadE_._xscale = -100;
}
maxEnemies--;
hold_enemyUnit[i].removeMovieClip();
hold_enemyUnit.splice(i, 1);
frameNumber.splice(i, 1);
enemyHealth.splice(i, 1);
enemyWalking.splice(i, 1);
enemyFacingRight.splice(i, 1);
}
}
if (hold_enemyUnit[i].hitTest(_root.player)) {
frameNumber[i]++;
if (frameNumber[i] == 18) {
if (enemyFacingRight[i] == false) {
_root.attachMovie("enemy_hitep", "enemy_hit", _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x, _y:hold_enemyUnit[i]._y});
} else {
_root.attachMovie("enemy_hitep", "enemy_hit", _root.getNextHighestDepth(), {_x:hold_enemyUnit[i]._x + 80, _y:hold_enemyUnit[i]._y});
}
}
enemyWalking[i] = false;
hold_enemyUnit[i].gotoAndStop("attack");
if (_root.player.hitTest(enemy_hit)) {
playerHealth--;
taking_damage = true;
frameNumber[i] = 0;
}
} else {
frameNumber[i] = 0;
enemyWalking[i] = true;
hold_enemyUnit[i].gotoAndStop("walk");
}
i--;
}
}
function attachEnemyUnit() {
if (!Pause) {
if (!guardianDead) {
if (maxEnemies < 11) {
releaseEnemyUnitTimer = releaseEnemyUnitTimer - 1;
if (releaseEnemyUnitTimer == 0) {
maxEnemies++;
dir = ["left", "right"];
randNum = random(2);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomNumber++;
Enemy_Unit = _root.attachMovie("enemyUnitep", "enemyUnit" + randomNumber, _root.getNextHighestDepth(), {_x:600, _y:355});
hold_enemyUnit.push(Enemy_Unit);
frameNumber.push(0);
enemyHealth.push(40);
enemyWalking.push(true);
enemyFacingRight.push(false);
break;
case "right" :
randomNumber++;
Enemy_Unit = _root.attachMovie("enemyUnitep", "enemyUnit" + randomNumber, _root.getNextHighestDepth(), {_x:-100, _y:355});
hold_enemyUnit.push(Enemy_Unit);
frameNumber.push(0);
enemyHealth.push(40);
enemyWalking.push(true);
enemyFacingRight.push(false);
}
releaseEnemyUnitTimer = 130;
}
}
}
}
}
function ereaseFriendlyUnit() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i]._x > 9000) {
maxUnits--;
randomNumber++;
_root.attachMovie("friendly_dead", "friendly_dead" + randomNumber, _root.getNextHighestDepth(), {_x:hold_friendlyUnit[i]._x, _y:hold_friendlyUnit[i]._y});
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
friendlyWalking.splice(i, 1);
UnitframeNumber.splice(i, 1);
UnitHealth.splice(i, 1);
}
i--;
}
}
function moveFriendlyLeft() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x - 5;
i--;
}
}
function moveFriendlyRight() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i]._x = hold_friendlyUnit[i]._x + 5;
i--;
}
}
function moveEnemyLeft() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x - 5;
i--;
}
}
function moveEnemyRight() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i]._x = hold_enemyUnit[i]._x + 5;
i--;
}
}
function restrictFirst() {
if (is_attacking < 0) {
is_attacking = 0;
attacking = false;
}
}
function restrictSecond() {
if (is_attacking2 < 0) {
is_attacking2 = 0;
attacking = false;
}
}
function restrictThird() {
if (is_attacking3 < 0) {
is_attacking3 = 0;
attacking = false;
}
}
function playerJump() {
yspeed = yspeed + down_force;
_root.player._y = _root.player._y + yspeed;
}
function playerOnGround() {
if (player._y > 365) {
_root.player._y = 365;
airCombo = 3;
yspeed = 0;
jumping = false;
jump_power = 15;
down_force = 0;
}
}
function addComboPoint() {
if (mouseDown_) {
if ((is_attacking > 0) && (is_attacking < 6)) {
combo = 1;
}
if ((is_attacking2 > 0) && (is_attacking2 < 6)) {
combo = 2;
}
}
}
function hover() {
if (attacking) {
down_force = 0;
yspeed = 0;
} else {
down_force = 1;
}
}
function playerCombo1() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 0) {
is_attacking = is_attacking - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack1");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack1");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
}
}
}
}
}
}
}
function playerCombo2() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 1) {
is_attacking = 0;
is_attacking2 = is_attacking2 - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack2");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack2");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
}
}
}
}
}
}
}
function playerCombo3() {
if (!taking_damage) {
if (!attacking) {
if (jumping) {
player.gotoAndStop("inAir");
}
} else if (attacking) {
if (combo == 2) {
is_attacking2 = 0;
is_attacking3 = is_attacking3 - 1;
if (jumping) {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("airAttack3");
} else {
player_hit.removeMovieClip();
_root.attachMovie("player_hit", "player_hit", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
player_hit._alpha = 0;
player.gotoAndStop("attack3");
}
if (is_attacking == 0) {
if (is_attacking2 == 0) {
if (is_attacking3 == 0) {
attacking = false;
combo = 0;
}
}
}
}
}
}
}
function beingHit() {
if (taking_damage) {
ouch = ouch - 1;
if (!jumping) {
player.gotoAndPlay("hitGround");
} else {
player.gotoAndPlay("hitAir");
}
if (ouch == 0) {
hit_sound.start();
taking_damage = false;
ouch = 3;
}
}
}
function correct_player_hit_placement() {
if (going_right) {
_root.player_hit._xscale = 100;
}
if (going_left) {
_root.player_hit._xscale = -100;
}
}
function playerMovements() {
if (!taking_damage) {
if (!attacking) {
if (Key.isDown(38) or Key.isDown(87)) {
yspeed = yspeed - jump_power;
jumping = true;
jump_power = 0;
down_force = 1;
player.gotoAndStop("jump");
}
if (Key.isDown(39) or Key.isDown(68)) {
going_left = false;
going_right = true;
_root.player._xscale = 100;
_root.player._x = _root.player._x + playerSpeed;
if (!jumping) {
player.gotoAndStop("running");
}
} else if (Key.isDown(37) or Key.isDown(65)) {
going_left = true;
going_right = false;
_root.player._xscale = -100;
_root.player._x = _root.player._x - playerSpeed;
if (!jumping) {
player.gotoAndStop("running");
}
} else if (!jumping) {
player.gotoAndStop("idle");
}
}
}
}
function Bounds() {
if (player._x > 380) {
if (_root.grass._x > -6450) {
moveFriendlyLeft();
moveEnemyLeft();
enemyGuardian._x = enemyGuardian._x - 15;
_root.deadE_._x = _root.deadE_._x - 15;
_root.player._x = 380;
_root.grass._x = _root.grass._x - 15;
_root.city._x = _root.city._x - 12;
_root.sky._x = _root.sky._x - 1;
_root.mountains._x = _root.mountains._x - 2;
} else {
_root.player._x = 380;
if (!jumping) {
_root.player.gotoAndStop("idle");
} else {
_root.player.gotoAndStop("jump");
}
enemyGuardian._x = enemyGuardian._x - 0;
_root.deadE_._x = _root.deadE_._x - 0;
_root.grass._x = _root.grass._x - 0;
_root.city._x = _root.city._x - 0;
_root.sky._x = _root.sky._x - 0;
_root.mountains._x = _root.mountains._x - 0;
}
} else if (player._x < 150) {
if (_root.grass._x < -20) {
moveFriendlyRight();
moveEnemyRight();
enemyGuardian._x = enemyGuardian._x + 15;
_root.deadE_._x = _root.deadE_._x + 15;
_root.player._x = 150;
_root.grass._x = _root.grass._x + 15;
_root.city._x = _root.city._x + 12;
_root.sky._x = _root.sky._x + 1;
_root.mountains._x = _root.mountains._x + 2;
} else {
_root.player._x = 150;
if (!jumping) {
_root.player.gotoAndStop("idle");
} else {
_root.player.gotoAndStop("jump");
}
enemyGuardian._x = enemyGuardian._x + 0;
_root.deadE_._x = _root.deadE_._x + 0;
_root.grass._x = _root.grass._x + 0;
_root.city._x = _root.city._x + 0;
_root.sky._x = _root.sky._x + 0;
_root.mountains._x = _root.mountains._x + 0;
}
}
}
function attatchUnit() {
if (exp > 9) {
if (maxUnits < 11) {
if (releaseUnit) {
releaseTimer = releaseTimer - 1;
}
if (releaseTimer == 0) {
releaseUnit = false;
releaseTimer = 90;
exp = exp - 10;
maxUnits++;
randomNumber++;
friendlyUnit = attachMovie("friendly_red", "friendly" + randomNumber, _root.getNextHighestDepth(), {_x:-300, _y:360});
hold_friendlyUnit.push(friendlyUnit);
friendlyWalking.push(true);
UnitframeNumber.push(0);
UnitHealth.push(35);
}
}
}
}
function blockMinusExp() {
if (exp < 0) {
exp = 0;
}
}
function pause_game() {
if (!Pause) {
if (Key.isDown(80)) {
Mouse.show();
Pause = true;
_root.attachMovie("pauseScreen", "pauseScreen", _root.getNextHighestDepth(), {_x:0, _y:0});
}
}
}
function unpause_game() {
if (Pause) {
if (Key.isDown(85)) {
Mouse.hide();
Pause = false;
pauseScreen.removeMovieClip();
}
}
}
function gameOver() {
if (playerHealth < 1) {
removefriendlyWalking();
removeenemyFacingRight();
removeenemyWalking();
removeUnitHealth();
removeenemyHealth();
removeUnitframeNumber();
removeframeNumber();
removehold_enemyUnit();
removehold_friendlyUnit();
player.removeMovieClip();
enemyGuardian.removeMovieClip();
stopAllSounds();
warning.removeMovieClip();
gotoAndStop ("game_over5");
}
}
function gameOverVictory() {
if (guardianDead) {
if (maxEnemies == 0) {
level = 5;
removefriendlyWalking();
removeenemyFacingRight();
removeenemyWalking();
removeUnitHealth();
removeenemyHealth();
removeUnitframeNumber();
removeframeNumber();
removehold_enemyUnit();
removehold_friendlyUnit();
warning.removeMovieClip();
delay++;
if (delay == 96) {
player.removeMovieClip();
enemyGuardian.removeMovieClip();
stopAllSounds();
gotoAndStop ("game_over_victory5");
}
}
}
}
function removehold_friendlyUnit() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
hold_friendlyUnit[i].removeMovieClip();
hold_friendlyUnit.splice(i, 1);
i--;
}
}
function removehold_enemyUnit() {
i = hold_enemyUnit.length - 1;
while (i >= 0) {
hold_enemyUnit[i].removeMovieClip();
hold_enemyUnit.splice(i, 1);
i--;
}
}
function removeframeNumber() {
i = frameNumber.length - 1;
while (i >= 0) {
frameNumber[i].removeMovieClip();
frameNumber.splice(i, 1);
i--;
}
}
function removeUnitframeNumber() {
i = UnitframeNumber.length - 1;
while (i >= 0) {
UnitframeNumber[i].removeMovieClip();
UnitframeNumber.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removeUnitHealth() {
i = UnitHealth.length - 1;
while (i >= 0) {
UnitHealth[i].removeMovieClip();
UnitHealth.splice(i, 1);
i--;
}
}
function removeenemyWalking() {
i = enemyWalking.length - 1;
while (i >= 0) {
enemyWalking[i].removeMovieClip();
enemyWalking.splice(i, 1);
i--;
}
}
function removeenemyFacingRight() {
i = enemyFacingRight.length - 1;
while (i >= 0) {
enemyFacingRight[i].removeMovieClip();
enemyFacingRight.splice(i, 1);
i--;
}
}
function removefriendlyWalking() {
i = friendlyWalking.length - 1;
while (i >= 0) {
friendlyWalking[i].removeMovieClip();
friendlyWalking.splice(i, 1);
i--;
}
}
function moreExpNeeded() {
if (exp < 10) {
needexp._x = -4.3;
needexp._y = 72.8;
} else {
needexp._x = -50;
needexp._y = -50;
}
}
function maximumUnits() {
if (maxUnits > 10) {
maximum_units._x = 22.1;
maximum_units._y = 32.6;
} else {
maximum_units._x = -50;
maximum_units._y = -50;
}
}
function theMouseIssue() {
Mouse.hide();
endX = _root._xmouse;
endY = _root._ymouse;
Icon._x = Icon._x + (endX - Icon._x);
Icon._y = Icon._y + (endY - Icon._y);
if (mouseArea.hitTest(_root._xmouse, _root._ymouse, true)) {
Icon.gotoAndStop("one");
} else {
Icon.gotoAndStop("two");
}
}
function attachWarning() {
if (grass._x < -2335) {
onlyOnce++;
if (onlyOnce == 1) {
warningTwo.removeMovieClip();
_root.attachMovie("warning", "warning", _root.getNextHighestDepth(), {_x:140, _y:145});
}
}
}
function unitVsGuardianWaning() {
i = hold_friendlyUnit.length - 1;
while (i >= 0) {
if (hold_friendlyUnit[i].hitTest(enemyGuardian)) {
if (hold_friendlyUnit[i]._x > (player._x + 700)) {
onceAgain++;
if (onceAgain == 1) {
warning.removeMovieClip();
_root.attachMovie("warningTwo", "warningTwo", _root.getNextHighestDepth(), {_x:140, _y:145});
}
} else {
onceAgain = 0;
}
}
i--;
}
}
stop();
onceAgain = 0;
onlyOnce = 0;
playonce = 0;
youAreFucked = false;
FSdeath_sound = new Sound();
FSdeath_sound.attachSound("FSdeath");
hit_sound = new Sound();
hit_sound.attachSound("hit");
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:25, _y:365});
_root.attachMovie("objective5", "objective1", _root.getNextHighestDepth(), {_x:65, _y:140});
_root.attachMovie("enemyGuardian", "enemyGuardian", _root.getNextHighestDepth(), {_x:5500, _y:15});
var hold_friendlyUnit = new Array();
var hold_enemyUnit = new Array();
var frameNumber = new Array();
var UnitframeNumber = new Array();
var enemyHealth = new Array();
var UnitHealth = new Array();
var enemyWalking = new Array();
var enemyFacingRight = new Array();
var friendlyWalking = new Array();
level = 5;
playerHealth = 500;
dino_speed = 350;
playerSpeed = 10;
down_force = 1;
yspeed = 0;
locked = false;
jumping = false;
jump_power = 15;
taking_damage = false;
going_left = false;
going_right = true;
attacking = false;
mouseDown_ = false;
releaseUnit = false;
enemyTakingDamage = false;
randomNumber = 0;
is_attacking = 0;
is_attacking2 = 0;
is_attacking3 = 0;
unitSpeed = 5;
comboTimer = 45;
combo = 0;
releaseTimer = 90;
runningRight = false;
runningLeft = false;
ouch = 3;
releaseEnemyUnitTimer = 260;
attachBlood = 0;
attachGuardianHit = 0;
guardianHealth = 100;
releaseGuardian = false;
maxUnits = 0;
maxEnemies = 0;
exp = 0;
delay = 0;
Pause = false;
guardianDead = false;
_root.onMouseUp = function () {
mouseDown_ = false;
down_force = 1;
};
_root.onMouseDown = function () {
mouseDown_ = true;
if (!add_unit1.hitTest(_root._xmouse, _root._ymouse, true)) {
attacking = true;
if (combo == 0) {
if (is_attacking == 0) {
is_attacking = 20;
}
}
if (combo == 1) {
if (is_attacking2 == 0) {
is_attacking2 = 11;
}
}
if (combo == 2) {
if (is_attacking3 == 0) {
is_attacking3 = 11;
}
}
}
};
add_unit1.onEnterFrame = function () {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
add_unit1.gotoAndStop("down");
if (mouseDown_) {
releaseUnit = true;
}
} else {
add_unit1.gotoAndStop("up");
}
};
player.onEnterFrame = function () {
if (!Pause) {
blockMinusExp();
ereaseFriendlyUnit();
moveFriendlyLeft();
moveFriendlyRight();
attatchUnit();
playerCombo1();
playerCombo2();
playerCombo3();
playerMovements();
playerJump();
playerOnGround();
Bounds();
addComboPoint();
restrictFirst();
restrictSecond();
restrictThird();
beingHit();
hover();
correct_player_hit_placement();
attachEnemyUnit();
enemyActions();
facePlayer();
enemyMoveToPlayer();
helpUnitsVsEnemyUnits();
friendlyMove();
enemyGuardianMoveToPlayer();
playerVsGuardian();
murkFriendlyUnits();
randomAttack();
guardianFacePlayer();
bossKilled();
moreExpNeeded();
maximumUnits();
guardianWillKillYou();
theMouseIssue();
attachWarning();
unitVsGuardianWaning();
}
};
ppp.onEnterFrame = function () {
gameOverVictory();
gameOver();
pause_game();
unpause_game();
};
Frame 100
stop();
Mouse.show();
Frame 101
stop();
Mouse.show();
Frame 102
stop();
Mouse.show();
Frame 103
stop();
Mouse.show();
Frame 104
stop();
Mouse.show();
Frame 105
var hs = (new com.stoneage.hiscores.hiscore());
var userEventHandler = new Object();
userEventHandler.handleEvent = function (eventObj) {
status_txt.text = hs.state;
};
hs.addEventListener("scoreSubmitted", userEventHandler);
Stage.addListener(userEventHandler);
submit.onRelease = function () {
hs.url = "http://www.stoneagegames.com/index.php";
hs.game = 2;
hs.salt = 123;
hs.sendScore(username.text, score);
getURL (" http://www.stoneagegames.com/hiscore/2", "_blank");
_root.gotoAndStop("title");
};
stop();
Frame 106
stop();
Mouse.show();
Frame 107
stop();
Mouse.show();
Frame 108
stop();
Mouse.show();
Frame 109
stop();
Mouse.show();
Frame 110
stop();
Mouse.show();
Symbol 819 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var _local4 = queue.length;
var _local1;
_local1 = 0;
while (_local1 < _local4) {
var _local2 = queue[_local1];
if (_local2 == handler) {
queue.splice(_local1, 1);
return(undefined);
}
_local1++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var _local7 = "__q_" + eventObj.type;
var _local4 = queueObj[_local7];
if (_local4 != undefined) {
var _local5;
for (_local5 in _local4) {
var _local1 = _local4[_local5];
var _local3 = typeof(_local1);
if ((_local3 == "object") || (_local3 == "movieclip")) {
if (_local1.handleEvent != undefined) {
_local1.handleEvent(eventObj);
}
if (_local1[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
_local1[eventObj.type](eventObj);
}
}
} else {
_local1.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var _local3 = "__q_" + event;
if (this[_local3] == undefined) {
this[_local3] = new Array();
}
_global.ASSetPropFlags(this, _local3, 1);
_removeEventListener(this[_local3], event, handler);
this[_local3].push(handler);
}
function removeEventListener(event, handler) {
var _local2 = "__q_" + event;
_removeEventListener(this[_local2], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 820 MovieClip [__Packages.com.stoneage.hiscores.hiscore] Frame 0
class com.stoneage.hiscores.hiscore
{
var serverVars, fsalt, furl, dispatchEvent, fState, fgame;
function hiscore () {
serverVars = new LoadVars();
serverVars.owner = this;
fsalt = 123;
furl = "";
serverVars.onLoad = function (sucess) {
this.owner.succeed = sucess;
if (sucess) {
this.owner.state = "OK";
} else {
this.owner.state = "Failed";
}
this.owner.varsLoaded(this);
};
}
function hex_md5(s) {
return(binl2hex(core_md5(str2binl(s), s.length * chrsz)));
}
function b64_md5(s) {
return(binl2b64(core_md5(str2binl(s), s.length * chrsz)));
}
function str_md5(s) {
return(binl2str(core_md5(str2binl(s), s.length * chrsz)));
}
function hex_hmac_md5(key, data) {
return(binl2hex(core_hmac_md5(key, data)));
}
function b64_hmac_md5(key, data) {
return(binl2b64(core_hmac_md5(key, data)));
}
function str_hmac_md5(key, data) {
return(binl2str(core_hmac_md5(key, data)));
}
function md5_vm_test() {
return(hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72");
}
function core_md5(x, len) {
x[len >> 5] = x[len >> 5] | (128 << (len % 32));
x[(((len + 64) >>> 9) << 4) + 14] = len;
var _local5 = 1732584193 /* 0x67452301 */;
var _local4 = -271733879;
var _local3 = -1732584194;
var _local2 = 271733878 /* 0x10325476 */;
var _local6 = 0;
while (_local6 < x.length) {
var _local11 = _local5;
var _local10 = _local4;
var _local9 = _local3;
var _local8 = _local2;
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 0], 7, -680876936);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 1], 12, -389564586);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 2], 17, 606105819);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 3], 22, -1044525330);
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 4], 7, -176418897);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 5], 12, 1200080426);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 6], 17, -1473231341);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 7], 22, -45705983);
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 8], 7, 1770035416);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 9], 12, -1958414417);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 10], 17, -42063);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 11], 22, -1990404162);
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 12], 7, 1804603682);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 13], 12, -40341101);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 14], 17, -1502002290);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 15], 22, 1236535329);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 1], 5, -165796510);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 6], 9, -1069501632);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 11], 14, 643717713);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 0], 20, -373897302);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 5], 5, -701558691);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 10], 9, 38016083);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 15], 14, -660478335);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 4], 20, -405537848);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 9], 5, 568446438);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 14], 9, -1019803690);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 3], 14, -187363961);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 8], 20, 1163531501);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 13], 5, -1444681467);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 2], 9, -51403784);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 7], 14, 1735328473);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 12], 20, -1926607734);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 5], 4, -378558);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 8], 11, -2022574463);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 11], 16, 1839030562);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 14], 23, -35309556);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 1], 4, -1530992060);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 4], 11, 1272893353);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 7], 16, -155497632);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 10], 23, -1094730640);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 13], 4, 681279174);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 0], 11, -358537222);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 3], 16, -722521979);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 6], 23, 76029189);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 9], 4, -640364487);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 12], 11, -421815835);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 15], 16, 530742520);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 2], 23, -995338651);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 0], 6, -198630844);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 7], 10, 1126891415);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 14], 15, -1416354905);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 5], 21, -57434055);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 12], 6, 1700485571);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 3], 10, -1894986606);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 10], 15, -1051523);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 1], 21, -2054922799);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 8], 6, 1873313359);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 15], 10, -30611744);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 6], 15, -1560198380);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 13], 21, 1309151649);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 4], 6, -145523070);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 11], 10, -1120210379);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 2], 15, 718787259);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 9], 21, -343485551);
_local5 = safe_add(_local5, _local11);
_local4 = safe_add(_local4, _local10);
_local3 = safe_add(_local3, _local9);
_local2 = safe_add(_local2, _local8);
_local6 = _local6 + 16;
}
return(Array(_local5, _local4, _local3, _local2));
}
function md5_cmn(q, a, b, x, s, t) {
return(safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
}
function md5_ff(a, b, c, d, x, s, t) {
return(md5_cmn((b & c) | ((~b) & d), a, b, x, s, t));
}
function md5_gg(a, b, c, d, x, s, t) {
return(md5_cmn((b & d) | (c & (~d)), a, b, x, s, t));
}
function md5_hh(a, b, c, d, x, s, t) {
return(md5_cmn((b ^ c) ^ d, a, b, x, s, t));
}
function md5_ii(a, b, c, d, x, s, t) {
return(md5_cmn(c ^ (b | (~d)), a, b, x, s, t));
}
function core_hmac_md5(key, data) {
var _local3 = str2binl(key);
if (_local3.length > 16) {
_local3 = core_md5(_local3, key.length * chrsz);
}
var _local4 = Array(16);
var _local5 = Array(16);
var _local2 = 0;
while (_local2 < 16) {
_local4[_local2] = _local3[_local2] ^ 909522486;
_local5[_local2] = _local3[_local2] ^ 1549556828;
_local2++;
}
var _local6 = core_md5(_local4.concat(str2binl(data)), 512 + (data.length * chrsz));
return(core_md5(_local5.concat(_local6), 640));
}
function hex_sha1(s) {
return(binb2hex(core_sha1(str2binb(s), s.length * chrsz)));
}
function b64_sha1(s) {
return(binb2b64(core_sha1(str2binb(s), s.length * chrsz)));
}
function str_sha1(s) {
return(binb2str(core_sha1(str2binb(s), s.length * chrsz)));
}
function hex_hmac_sha1(key, data) {
return(binb2hex(core_hmac_sha1(key, data)));
}
function b64_hmac_sha1(key, data) {
return(binb2b64(core_hmac_sha1(key, data)));
}
function str_hmac_sha1(key, data) {
return(binb2str(core_hmac_sha1(key, data)));
}
function sha1_vm_test() {
return(hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d");
}
function core_sha1(x, len) {
x[len >> 5] = x[len >> 5] | (128 << (24 - (len % 32)));
x[(((len + 64) >> 9) << 4) + 15] = len;
var _local3 = Array(80);
var _local7 = 1732584193 /* 0x67452301 */;
var _local6 = -271733879;
var _local5 = -1732584194;
var _local4 = 271733878 /* 0x10325476 */;
var _local8 = -1009589776;
var _local10 = 0;
while (_local10 < x.length) {
var _local16 = _local7;
var _local15 = _local6;
var _local14 = _local5;
var _local13 = _local4;
var _local12 = _local8;
var _local2 = 0;
while (_local2 < 80) {
if (_local2 < 16) {
_local3[_local2] = x[_local10 + _local2];
} else {
_local3[_local2] = rol(((_local3[_local2 - 3] ^ _local3[_local2 - 8]) ^ _local3[_local2 - 14]) ^ _local3[_local2 - 16], 1);
}
var _local9 = safe_add(safe_add(rol(_local7, 5), sha1_ft(_local2, _local6, _local5, _local4)), safe_add(safe_add(_local8, _local3[_local2]), sha1_kt(_local2)));
_local8 = _local4;
_local4 = _local5;
_local5 = rol(_local6, 30);
_local6 = _local7;
_local7 = _local9;
_local2++;
}
_local7 = safe_add(_local7, _local16);
_local6 = safe_add(_local6, _local15);
_local5 = safe_add(_local5, _local14);
_local4 = safe_add(_local4, _local13);
_local8 = safe_add(_local8, _local12);
_local10 = _local10 + 16;
}
return(Array(_local7, _local6, _local5, _local4, _local8));
}
function sha1_ft(t, b, c, d) {
if (t < 20) {
return((b & c) | ((~b) & d));
}
if (t < 40) {
return((b ^ c) ^ d);
}
if (t < 60) {
return(((b & c) | (b & d)) | (c & d));
}
return((b ^ c) ^ d);
}
function sha1_kt(t) {
return(((t < 20) ? 1518500249 : (((t < 40) ? 1859775393 : (((t < 60) ? -1894007588 : -899497514))))));
}
function core_hmac_sha1(key, data) {
var _local3 = str2binb(key);
if (_local3.length > 16) {
_local3 = core_sha1(_local3, key.length * chrsz);
}
var _local4 = Array(16);
var _local5 = Array(16);
var _local2 = 0;
while (_local2 < 16) {
_local4[_local2] = _local3[_local2] ^ 909522486;
_local5[_local2] = _local3[_local2] ^ 1549556828;
_local2++;
}
var _local6 = core_sha1(_local4.concat(str2binb(data)), 512 + (data.length * chrsz));
return(core_sha1(_local5.concat(_local6), 672));
}
function safe_add(x, y) {
var _local1 = (x & 65535) + (y & 65535);
var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
return((_local2 << 16) | (_local1 & 65535));
}
function bit_rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
function str2binl(str) {
var _local4 = Array();
var _local5 = (1 << chrsz) - 1;
var _local2 = 0;
while (_local2 < (str.length * chrsz)) {
_local4[_local2 >> 5] = _local4[_local2 >> 5] | ((str.charCodeAt(_local2 / chrsz) & _local5) << (_local2 % 32));
_local2 = _local2 + chrsz;
}
return(_local4);
}
function binl2str(bin) {
var _local4 = "";
var _local5 = (1 << chrsz) - 1;
var _local2 = 0;
while (_local2 < (bin.length * 32)) {
_local4 = _local4 + String.fromCharCode((bin[_local2 >> 5] >>> (_local2 % 32)) & _local5);
_local2 = _local2 + chrsz;
}
return(_local4);
}
function binl2hex(binarray) {
var _local4 = (hexcase ? "0123456789ABCDEF" : "0123456789abcdef");
var _local5 = "";
var _local2 = 0;
while (_local2 < (binarray.length * 4)) {
_local5 = _local5 + (_local4.charAt((binarray[_local2 >> 2] >> (((_local2 % 4) * 8) + 4)) & 15) + _local4.charAt((binarray[_local2 >> 2] >> ((_local2 % 4) * 8)) & 15));
_local2++;
}
return(_local5);
}
function binl2b64(binarray) {
var _local7 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var _local5 = "";
var _local3 = 0;
while (_local3 < (binarray.length * 4)) {
var _local6 = ((((binarray[_local3 >> 2] >> (8 * (_local3 % 4))) & 255) << 16) | (((binarray[(_local3 + 1) >> 2] >> (8 * ((_local3 + 1) % 4))) & 255) << 8)) | ((binarray[(_local3 + 2) >> 2] >> (8 * ((_local3 + 2) % 4))) & 255);
var _local2 = 0;
while (_local2 < 4) {
if (((_local3 * 8) + (_local2 * 6)) > (binarray.length * 32)) {
_local5 = _local5 + b64pad;
} else {
_local5 = _local5 + _local7.charAt((_local6 >> (6 * (3 - _local2))) & 63);
}
_local2++;
}
_local3 = _local3 + 3;
}
return(_local5);
}
function rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
function str2binb(str) {
var _local4 = Array();
var _local5 = (1 << chrsz) - 1;
var _local2 = 0;
while (_local2 < (str.length * chrsz)) {
_local4[_local2 >> 5] = _local4[_local2 >> 5] | ((str.charCodeAt(_local2 / chrsz) & _local5) << ((32 - chrsz) - (_local2 % 32)));
_local2 = _local2 + chrsz;
}
return(_local4);
}
function binb2str(bin) {
var _local4 = "";
var _local5 = (1 << chrsz) - 1;
var _local2 = 0;
while (_local2 < (bin.length * 32)) {
_local4 = _local4 + String.fromCharCode((bin[_local2 >> 5] >>> ((32 - chrsz) - (_local2 % 32))) & _local5);
_local2 = _local2 + chrsz;
}
return(_local4);
}
function binb2hex(binarray) {
var _local4 = (hexcase ? "0123456789ABCDEF" : "0123456789abcdef");
var _local5 = "";
var _local2 = 0;
while (_local2 < (binarray.length * 4)) {
_local5 = _local5 + (_local4.charAt((binarray[_local2 >> 2] >> (((3 - (_local2 % 4)) * 8) + 4)) & 15) + _local4.charAt((binarray[_local2 >> 2] >> ((3 - (_local2 % 4)) * 8)) & 15));
_local2++;
}
return(_local5);
}
function binb2b64(binarray) {
var _local7 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var _local5 = "";
var _local3 = 0;
while (_local3 < (binarray.length * 4)) {
var _local6 = ((((binarray[_local3 >> 2] >> (8 * (3 - (_local3 % 4)))) & 255) << 16) | (((binarray[(_local3 + 1) >> 2] >> (8 * (3 - ((_local3 + 1) % 4)))) & 255) << 8)) | ((binarray[(_local3 + 2) >> 2] >> (8 * (3 - ((_local3 + 2) % 4)))) & 255);
var _local2 = 0;
while (_local2 < 4) {
if (((_local3 * 8) + (_local2 * 6)) > (binarray.length * 32)) {
_local5 = _local5 + b64pad;
} else {
_local5 = _local5 + _local7.charAt((_local6 >> (6 * (3 - _local2))) & 63);
}
_local2++;
}
_local3 = _local3 + 3;
}
return(_local5);
}
static function UserStaticConstructor() {
mx.events.EventDispatcher.initialize(com.stoneage.hiscores.hiscore.prototype);
return(true);
}
function varsLoaded(objEvent) {
dispatchEvent({target:this, type:"scoreSubmitted", data:objEvent});
}
function get state() {
return(fState);
}
function set state(aState) {
fState = aState;
//return(state);
}
function set url(aUrl) {
furl = aUrl;
//return(url);
}
function get salt() {
return(fsalt);
}
function set salt(aSalt) {
fsalt = aSalt;
//return(salt);
}
function get url() {
return(furl);
}
function get game() {
return(fgame);
}
function set game(aGame) {
fgame = aGame;
//return(game);
}
function sendScore(aName, aScore) {
serverVars.op = "hiscore";
serverVars.m2m = true;
serverVars.gameid = fgame;
serverVars.score = aScore;
serverVars.name = aName;
serverVars.hash = calcHash(aName, aScore);
if (isNaN(aScore)) {
state = ("invalid score(not a number)");
dispatchEvent({target:this, type:"scoreSubmitted", data:Void});
} else if (isNaN(fgame)) {
state = ("invalid game(not a number)");
dispatchEvent({target:this, type:"scoreSubmitted", data:Void});
} else if (((furl == "") || (aName == "")) || (aName == Void)) {
state = ("invalid name or url");
dispatchEvent({target:this, type:"scoreSubmitted", data:Void});
} else {
state = ("sending");
serverVars.sendAndLoad(furl, serverVars, "POST");
}
}
function calcHash(aName, aScore) {
var _local2 = hex_md5(hex_sha1(aName + ((fgame + aScore) + fsalt)));
return(_local2);
}
var hexcase = 0;
var b64pad = "";
var chrsz = 8;
static var staticConstructorDependencies = [mx.events.EventDispatcher];
static var UserStaticConstructed = UserStaticConstructor();
}
Symbol 169 MovieClip [player] Frame 1
stop();
Symbol 169 MovieClip [player] Frame 2
stop();
Symbol 169 MovieClip [player] Frame 3
stop();
Symbol 169 MovieClip [player] Frame 4
stop();
Symbol 169 MovieClip [player] Frame 5
stop();
Symbol 169 MovieClip [player] Frame 6
stop();
Symbol 169 MovieClip [player] Frame 7
stop();
Symbol 169 MovieClip [player] Frame 8
stop();
Symbol 169 MovieClip [player] Frame 9
stop();
Symbol 169 MovieClip [player] Frame 10
stop();
Symbol 169 MovieClip [player] Frame 11
stop();
Symbol 169 MovieClip [player] Frame 12
stop();
Symbol 206 MovieClip [friendly] Frame 1
stop();
Symbol 206 MovieClip [friendly] Frame 2
stop();
Symbol 208 MovieClip [player_hit] Frame 2
this.removeMovieClip();
Symbol 245 MovieClip [enemyUnit] Frame 1
stop();
Symbol 245 MovieClip [enemyUnit] Frame 2
stop();
Symbol 267 MovieClip [deadE] Frame 26
this.removeMovieClip();
Symbol 278 MovieClip [blood] Frame 11
this.removeMovieClip();
Symbol 280 MovieClip [enemy_hit] Frame 5
this.removeMovieClip();
Symbol 369 MovieClip Frame 45
stop();
Symbol 370 MovieClip [enemyGuardian] Frame 1
stop();
Symbol 370 MovieClip [enemyGuardian] Frame 2
stop();
Symbol 370 MovieClip [enemyGuardian] Frame 3
stop();
Symbol 373 MovieClip [unit_attack] Frame 6
this.removeMovieClip();
Symbol 393 MovieClip [friendly_dead] Frame 21
this.removeMovieClip();
Symbol 413 MovieClip Frame 1
stop();
this.onEnterFrame = function () {
if (rewind == true) {
prevFrame();
}
};
this.onRollOver = function () {
rewind = false;
play();
};
this.onRollOut = function () {
rewind = true;
};
this.onRelease = function () {
_root.getURL("http://www.stoneagegames.com", "_blank");
};
Symbol 413 MovieClip Frame 2
stop();
Instance of Symbol 412 MovieClip in Symbol 413 MovieClip Frame 2
on (release) {
getURL ("http://www.stoneagegames.com", "_blank");
}
Symbol 457 MovieClip [alt_enemy] Frame 1
stop();
Symbol 457 MovieClip [alt_enemy] Frame 2
stop();
Symbol 460 MovieClip [guardian_hit] Frame 5
this.removeMovieClip();
Symbol 529 MovieClip [enemyUnitep] Frame 1
stop();
Symbol 529 MovieClip [enemyUnitep] Frame 2
stop();
Symbol 531 MovieClip [enemy_hitep] Frame 5
this.removeMovieClip();
Symbol 579 MovieClip [deadEepic] Frame 46
this.removeMovieClip();
Symbol 603 MovieClip [deadEb] Frame 23
this.removeMovieClip();
Symbol 606 MovieClip [warning] Frame 257
this.removeMovieClip();
Symbol 608 MovieClip [warningTwo] Frame 301
this.removeMovieClip();
Symbol 612 MovieClip [objective1] Frame 236
this.removeMovieClip();
Symbol 616 MovieClip [objective2] Frame 236
this.removeMovieClip();
Symbol 617 MovieClip [enemy_hitep2] Frame 5
this.removeMovieClip();
Symbol 620 MovieClip [objective3] Frame 560
this.removeMovieClip();
Symbol 621 MovieClip [friendly dead_red] Frame 21
this.removeMovieClip();
Symbol 622 MovieClip [friendly_red] Frame 1
stop();
Symbol 622 MovieClip [friendly_red] Frame 2
stop();
Symbol 624 MovieClip [objective4] Frame 275
this.removeMovieClip();
Symbol 626 MovieClip [objective5] Frame 275
this.removeMovieClip();
Symbol 644 MovieClip Frame 89
stop();
Symbol 652 MovieClip Frame 12
stop();
Symbol 656 Button
on (release) {
gotoAndPlay (2);
_root.soundstatus = "off";
}
Symbol 657 MovieClip Frame 11
stop();
Symbol 659 Button
on (release) {
gotoAndPlay (1);
_root.soundstatus = "on";
}
Symbol 660 MovieClip Frame 1
stop();
Symbol 660 MovieClip Frame 2
stop();
Instance of Symbol 664 MovieClip in Symbol 665 MovieClip Frame 1
onClipEvent (load) {
_root.soundstatus = "on";
_root.mySound = new Sound(_level0);
_root.mySound2 = new Sound(_level1);
_root.mySound3 = new Sound(_level2);
_root.mySound4 = new Sound(_level3);
_root.mySound5 = new Sound(_level4);
maxvolume = 100;
minvolume = 0;
}
onClipEvent (enterFrame) {
if (_root.soundstatus == "on") {
step = 5;
}
if (_root.soundstatus == "off") {
step = -5;
}
maxvolume = maxvolume + step;
if (maxvolume > 100) {
maxvolume = 100;
}
if (maxvolume < 0) {
maxvolume = 0;
}
_root.mySound.setVolume(maxvolume);
_root.mySound2.setVolume(maxvolume);
_root.mySound3.setVolume(maxvolume);
_root.mySound4.setVolume(maxvolume);
_root.mySound5.setVolume(maxvolume);
}
Symbol 667 MovieClip Frame 575
gotoAndPlay (524);
Symbol 671 MovieClip Frame 370
stop();
Symbol 673 MovieClip Frame 370
stop();
Symbol 675 MovieClip Frame 370
stop();
Symbol 677 MovieClip Frame 370
stop();
Symbol 682 MovieClip Frame 370
stop();
Symbol 685 MovieClip Frame 1
stop();
this.onEnterFrame = function () {
if (rewind == true) {
prevFrame();
}
};
this.onRollOver = function () {
rewind = false;
play();
};
this.onRollOut = function () {
rewind = true;
};
this.onRelease = function () {
_root.getURL("http://www.stoneagegames.com", "_blank");
};
Symbol 685 MovieClip Frame 2
stop();
Instance of Symbol 13 MovieClip in Symbol 685 MovieClip Frame 2
on (release) {
getURL ("http://www.stoneagegames.com", "_blank");
}
Symbol 687 MovieClip Frame 370
stop();
Symbol 723 MovieClip Frame 1
stop();
Symbol 723 MovieClip Frame 2
stop();
Symbol 741 MovieClip Frame 1
stop();
Symbol 741 MovieClip Frame 2
stop();
Symbol 754 MovieClip Frame 1
stop();
Symbol 754 MovieClip Frame 2
stop();
Symbol 769 MovieClip Frame 159
stop();
Symbol 775 Button
on (press) {
gotoAndPlay ("levelTwo");
}
Symbol 776 Button
on (press) {
gotoAndPlay ("levelThree");
}
Symbol 777 Button
on (press) {
gotoAndPlay ("levelFour");
}
Symbol 778 Button
on (press) {
gotoAndPlay ("levelFive");
}
Symbol 780 MovieClip Frame 159
stop();
Symbol 783 Button
on (release) {
getURL ("http://www.stoneagegames.com", "_blank");
}
Symbol 786 Button
on (press) {
gotoAndPlay ("submit");
}
Symbol 789 Button
on (press) {
gotoAndPlay ("title");
}
Symbol 807 MovieClip Frame 292
stop();
Symbol 811 Button
on (press) {
gotoAndPlay ("levelOne");
}
Symbol 814 Button
on (release) {
getURL ("http://www.stoneagegames.com", "_blank");
}
Symbol 815 Button
on (press) {
gotoAndPlay ("levelTwo");
}
Symbol 816 Button
on (press) {
gotoAndPlay ("levelThree");
}
Symbol 817 Button
on (press) {
gotoAndPlay ("levelFour");
}
Symbol 818 Button
on (press) {
gotoAndPlay ("levelFive");
}