Frame 1
mochi.as2.MochiServices.connect("f51ea93fedac3189");
var myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
copyrightNotice.separatorBefore = true;
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(5);
}
Frame 2
gotoAndPlay (1);
Frame 5
_root.attachMovie("sound_contr", "sound_contr", 3, {_x:418, _y:378});
_root.attachMovie("qualityControl", "qualityControl", 4, {_x:5, _y:382});
_root.attachMovie("map", "map", _root.getNextHighestDepth());
map._alpha = 0;
sound_contr._alpha = 0;
qualityControl._alpha = 0;
marker = 0;
var double_click_wait = 300;
var lastClick = 0;
var mouseListener = new Object();
mouseListener.onMouseUp = function () {
if ((getTimer() - previousClick) < double_click_wait) {
playershoot();
previousClick = 0;
}
previousClick = getTimer();
};
Mouse.addListener(mouseListener);
Frame 6
logo.onPress = function () {
getURL ("http://www.xdgames.co.uk", "_blank");
};
Frame 8
stop();
stopAllSounds();
sound_contr._alpha = 100;
qualityControl._alpha = 100;
gun = 0;
score = 0;
qset = 0;
num = 0;
addit = 0;
exp = 0;
firstup = 0;
secondup = 0;
thirdup = 0;
fourthup = 0;
keyGone = false;
backToArea1 = false;
backToArea2 = false;
backToArea3 = false;
backToArea4 = false;
fromRandom = false;
backToArea5 = false;
fromRandom2 = false;
fromRandom3 = false;
backToArea6 = false;
backToArea7 = false;
backToArea8 = false;
fromRandom4 = false;
fromRandom5 = false;
fromRandom6 = false;
backToArea9 = false;
BbackToArea1 = false;
BbackToArea2 = false;
BbackToArea3 = false;
BbackToArea4 = false;
BfromRandom = false;
BbackToArea5 = false;
BfromRandom2 = false;
BfromRandom3 = false;
BbackToArea6 = false;
BbackToArea7 = false;
BbackToArea8 = false;
BfromRandom4 = false;
BfromRandom5 = false;
BfromRandom6 = false;
BbackToArea9 = false;
instructions._x = -500;
instructions._y = -500;
inti.onRelease = function () {
instructions._x = 400;
instructions._y = 200;
};
instructions.onRelease = function () {
instructions._x = -500;
instructions._y = -500;
};
skipbtn.onRelease = function () {
gotoAndStop ("stargame");
};
Instance of Symbol 375 MovieClip in Frame 8
on (release) {
var o = {n:[12, 2, 6, 8, 8, 6, 15, 13, 15, 12, 14, 7, 10, 14, 11, 7], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID});
}
Instance of Symbol 400 MovieClip "xdq" in Frame 8
on (press) {
getURL ("http://www.xdgames.co.uk", "_blank");
}
Frame 9
stop();
gotoAndStop ("title");
Frame 10
stop();
Mouse.show();
playingG = false;
marker = 0;
carryOn = "null";
yes.onRelease = function () {
carryOn = "true";
};
no.onRelease = function () {
upg1.removeMovieClip();
upg2.removeMovieClip();
upg3.removeMovieClip();
upg4.removeMovieClip();
carryOn = "false";
};
cont.onEnterFrame = function () {
if (carryOn == "false") {
gotoAndPlay ("completedG");
}
if (carryOn == "true") {
if (area == 1) {
score = 0;
gotoAndStop ("area1");
}
if (area == 2) {
score = 0;
gotoAndStop ("area2");
}
if (area == 3) {
score = 0;
gotoAndStop ("area3");
}
if (area == 4) {
score = 0;
gotoAndStop ("area4");
}
if (area == "side1") {
score = 0;
gotoAndStop ("side1");
}
if (area == 5) {
score = 0;
gotoAndStop ("area5");
}
if (area == "side2") {
score = 0;
gotoAndStop ("side2");
}
if (area == 6) {
score = 0;
gotoAndStop ("area6");
}
if (area == "side3") {
score = 0;
gotoAndStop ("side3");
}
if (area == 7) {
score = 0;
gotoAndStop ("area7");
}
if (area == 8) {
score = 0;
gotoAndStop ("area8");
}
if (area == "side4") {
score = 0;
gotoAndStop ("side4");
}
if (area == "side5") {
score = 0;
gotoAndStop ("side5");
}
if (area == "side6") {
score = 0;
gotoAndStop ("side6");
}
if (area == 9) {
score = 0;
gotoAndStop ("area9");
}
if (area == 10) {
score = 0;
gotoAndStop ("area10");
}
if (area == 11) {
score = 0;
gotoAndStop ("area11");
}
if (area == 12) {
score = 0;
gotoAndStop ("area12");
}
if (area == 13) {
score = 0;
gotoAndStop ("area13");
}
if (area == 14) {
score = 0;
gotoAndStop ("area14");
}
if (area == "side7") {
score = 0;
gotoAndStop ("side7");
}
if (area == 15) {
score = 0;
gotoAndStop ("area15");
}
if (area == "side8") {
score = 0;
gotoAndStop ("side8");
}
if (area == 16) {
score = 0;
gotoAndStop ("area16");
}
if (area == "side9") {
score = 0;
gotoAndStop ("side9");
}
if (area == 17) {
score = 0;
gotoAndStop ("area17");
}
if (area == "bossEncounter") {
gotoAndStop ("bossEncounter");
}
if (area == "side10") {
score = 0;
gotoAndStop ("side10");
}
if (area == "side11") {
score = 0;
gotoAndStop ("side11");
}
if (area == "side12") {
score = 0;
gotoAndStop ("side12");
}
}
};
Instance of Symbol 400 MovieClip "xdq" in Frame 10
on (press) {
getURL ("http://www.xdgames.co.uk", "_blank");
}
Frame 11
_root.attachMovie("teleporter", "teleporter", _root.getNextHighestDepth(), {_x:404, _y:200});
_root.attachMovie("object", "object", _root.getNextHighestDepth(), {_x:150, _y:200});
Frame 12
onlyOneTime = 0;
playingG = true;
map._alpha = 0;
map._x = 150;
map._y = 75;
map._xscale = 50;
map._yscale = 50;
map._rotation = 90;
map.onEnterFrame = function () {
if (marker > 1) {
marker = 0;
}
if (marker == 0) {
map._alpha = 0;
}
if (marker == 1) {
map._alpha = 80;
}
if (playingG) {
if (!Key.isDown(77)) {
onlyOneTime = 0;
}
if (Key.isDown(77)) {
if (onlyOneTime == 0) {
marker++;
onlyOneTime = 1;
}
}
}
};
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 50) {
canAttach = false;
}
if (killed == 50) {
teleporter.gotoAndStop("open");
} else {
teleporter.gotoAndStop("closed");
}
if (player.hitTest(teleporter._x, teleporter._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporter.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area2");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function addenemy() {
if ((releaseenemy + 700) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporter.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
if (gun < 1) {
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
}
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
if (gun < 1) {
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
}
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
Mouse.hide();
map.gotoAndStop("area1");
area = 1;
backToArea2 = false;
teleporter.removeMovieClip();
object.removeMovieClip();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("fortards", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporter", _root.getNextHighestDepth(), {_x:404, _y:200});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (!backToArea1) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:260, _y:200});
}
if (backToArea1) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporter._x, _y:teleporter._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
ouch = 3;
killed = 0;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 100;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
_root.attachMovie("object", "object", _root.getNextHighestDepth(), {_x:150, _y:200});
stuff.push(object);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 13
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 50) {
canAttach = false;
}
if (killed == 50) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area1");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area3");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function addenemy() {
if ((releaseenemy + 700) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area2");
area = 2;
backToArea1 = true;
backToArea3 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("background", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:110, _y:125});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:200, _y:300});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (!backToArea2) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (backToArea2) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 100;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:300, _y:80});
object1._xscale = 25;
object1._yscale = 25;
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:300, _y:180});
object2._xscale = 25;
object2._yscale = 25;
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:300, _y:280});
object3._xscale = 25;
object3._yscale = 25;
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
if (gun < 2) {
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:410, _y:180});
upgrade.push(powerUps);
}
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 14
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 20) {
canAttach = false;
}
if (killed == 20) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 20) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area2");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 20) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area4");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function addenemy() {
if ((releaseenemy + 700) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(20);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area3");
area = 3;
backToArea2 = true;
backToArea4 = false;
fromRandom = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:376, _y:337});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:109, _y:250});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (!backToArea3) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (backToArea3) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 70;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:300, _y:100});
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:200, _y:400});
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:100, _y:110});
object3._xscale = 60;
object3._yscale = 60;
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object4", _root.getNextHighestDepth(), {_x:210, _y:240});
object4._xscale = 110;
object4._yscale = 60;
stuff.push(object4);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object5", _root.getNextHighestDepth(), {_x:450, _y:240});
object4._xscale = 40;
object4._yscale = 40;
stuff.push(object5);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object6", _root.getNextHighestDepth(), {_x:20, _y:240});
object4._xscale = 25;
object4._yscale = 25;
stuff.push(object6);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 15
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 20) {
canAttach = false;
}
if (killed == 20) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
teleporterRANDOM.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
teleporterRANDOM.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 20) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area3");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 20) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area5");
}
}
if (player.hitTest(teleporterRANDOM._x, teleporterRANDOM._y, true)) {
if (killed == 20) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side1");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 1500) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 700) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(20);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area4");
area = 4;
backToArea3 = true;
backToArea5 = false;
fromRandom2 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:100, _y:150});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:275, _y:150});
_root.attachMovie("teleporter", "teleporterRANDOM", _root.getNextHighestDepth(), {_x:425, _y:150});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if ((!backToArea4) && (!fromRandom)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (backToArea4 && (!fromRandom)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
if ((!backToArea4) && (fromRandom)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterRANDOM._x, _y:teleporterRANDOM._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 160;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 16
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 10) {
canAttach = false;
}
if (killed == 10) {
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 10) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area4");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 1500) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 3500) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(200);
type.push(1);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(200);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(200);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(200);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side1");
area = "side1";
fromRandom = true;
backToArea4 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bga", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:260, _y:200});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
ouch = 3;
killed = 0;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 100;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
if (gun < 3) {
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:410, _y:200});
upgrade.push(powerUps);
}
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 17
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 10) {
canAttach = false;
}
if (killed == 10) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
teleporterRANDOM.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
teleporterRANDOM.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 10) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area4");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 10) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area6");
}
}
if (player.hitTest(teleporterRANDOM._x, teleporterRANDOM._y, true)) {
if (killed == 10) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side2");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 700) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 1200) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
type.push(1);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area5");
area = 5;
backToArea4 = true;
backToArea6 = false;
fromRandom = false;
fromRandom3 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bga", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:290, _y:190});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:60, _y:350});
_root.attachMovie("teleporter", "teleporterRANDOM", _root.getNextHighestDepth(), {_x:480, _y:50});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if ((!backToArea5) && (!fromRandom2)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (backToArea5 && (!fromRandom2)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
if ((!fromRandom5) && (fromRandom2)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterRANDOM._x, _y:teleporterRANDOM._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 160;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:400, _y:300});
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:150, _y:100});
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 18
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 1) {
canAttach = false;
}
if (killed == 1) {
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 1) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area5");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 250) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if (doOnce == 0) {
if (canAttach) {
enemyNumber++;
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("monster", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1000);
type.push(1);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("monster", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(1000);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("monster", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1000);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("monster", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(1000);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
doOnce = 1;
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
if (gun < 4) {
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
upgrade.push(powerUps);
}
score = score + 3000;
randomnumber++;
_root.attachMovie("plusMore", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i]--;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side2");
area = "side2";
doOnce = 0;
fromRandom2 = true;
backToArea5 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:260, _y:200});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 250;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 19
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 50) {
canAttach = false;
}
if (killed == 50) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
teleporterRANDOM.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
teleporterRANDOM.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area5");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area7");
}
}
if (player.hitTest(teleporterRANDOM._x, teleporterRANDOM._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side3");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 700) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 400) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area6");
area = 6;
backToArea5 = true;
backToArea7 = false;
fromRandom2 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("background", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:280, _y:190});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:60, _y:50});
_root.attachMovie("teleporter", "teleporterRANDOM", _root.getNextHighestDepth(), {_x:480, _y:50});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if ((!backToArea6) && (!fromRandom3)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (backToArea6 && (!fromRandom3)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
if ((!fromRandom6) && (fromRandom3)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterRANDOM._x, _y:teleporterRANDOM._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 80;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 20
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 70) {
canAttach = false;
}
if (killed == 70) {
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 70) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area6");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 250) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 250) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side3");
area = "side3";
fromRandom3 = true;
backToArea6 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bga", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:80, _y:120});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 60;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
if (!keyGone) {
_root.attachMovie("key", "object", _root.getNextHighestDepth(), {_x:520, _y:200});
stuff.push(object);
stuffHealth.push(300);
stuffDamagedTimer.push(0);
stuffHit.push(0);
}
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 21
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 25) {
canAttach = false;
}
if (killed == 25) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 25) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area6");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 25) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area8");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 1500) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 700) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(20);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(10);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(10);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area7");
area = 7;
backToArea6 = true;
backToArea8 = false;
fromRandom3 = false;
fromRandom4 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:60, _y:150});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:460, _y:50});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (!backToArea7) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (backToArea7) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 120;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:300, _y:80});
object1._xscale = 25;
object1._yscale = 25;
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:300, _y:180});
object2._xscale = 25;
object2._yscale = 25;
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:300, _y:280});
object3._xscale = 25;
object3._yscale = 25;
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object4", _root.getNextHighestDepth(), {_x:200, _y:80});
object4._xscale = 25;
object4._yscale = 25;
stuff.push(object4);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object5", _root.getNextHighestDepth(), {_x:200, _y:180});
object5._xscale = 25;
object5._yscale = 25;
stuff.push(object5);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object6", _root.getNextHighestDepth(), {_x:200, _y:280});
object6._xscale = 25;
object6._yscale = 25;
stuff.push(object6);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object7", _root.getNextHighestDepth(), {_x:400, _y:80});
object7._xscale = 25;
object7._yscale = 25;
stuff.push(object7);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object8", _root.getNextHighestDepth(), {_x:400, _y:180});
object8._xscale = 25;
object8._yscale = 25;
stuff.push(object8);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object9", _root.getNextHighestDepth(), {_x:400, _y:280});
object9._xscale = 25;
object9._yscale = 25;
stuff.push(object9);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 22
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 50) {
canAttach = false;
}
if (killed == 50) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
teleporterRANDOM.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
teleporterRANDOM.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area7");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area9");
}
}
if (player.hitTest(teleporterRANDOM._x, teleporterRANDOM._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side4");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 700) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 400) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area8");
area = 8;
backToArea7 = true;
backToArea9 = false;
fromRandom5 = false;
fromRandom6 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:280, _y:350});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:60, _y:50});
_root.attachMovie("teleporter", "teleporterRANDOM", _root.getNextHighestDepth(), {_x:480, _y:50});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if ((!backToArea8) && (!fromRandom4)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (backToArea8 && (!fromRandom4)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
if ((!fromRandom8) && (fromRandom4)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterRANDOM._x, _y:teleporterRANDOM._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 80;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
_root.attachMovie("object", "object4", _root.getNextHighestDepth(), {_x:70, _y:200});
stuff.push(object4);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object", _root.getNextHighestDepth(), {_x:170, _y:200});
stuff.push(object);
stuffHealth.push(25);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:270, _y:200});
stuff.push(object1);
stuffHealth.push(25);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:370, _y:200});
stuff.push(object2);
stuffHealth.push(25);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:470, _y:200});
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
if (gun < 2) {
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:410, _y:350});
upgrade.push(powerUps);
}
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 23
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 75) {
canAttach = false;
}
if (killed == 75) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
teleporterRANDOM.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
teleporterRANDOM.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 75) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area8");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 75) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side5");
}
}
if (player.hitTest(teleporterRANDOM._x, teleporterRANDOM._y, true)) {
if (killed == 75) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side6");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 700) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 100) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side4");
area = "side4";
fromRandom4 = true;
backToArea8 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:480, _y:350});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:480, _y:50});
_root.attachMovie("teleporter", "teleporterRANDOM", _root.getNextHighestDepth(), {_x:420, _y:50});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (((!backToArea8) && (!fromRandom5)) && (!fromRandom6)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (((!backToArea8) && (fromRandom5)) && (!fromRandom6)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
if (((!backToArea8) && (!fromRandom5)) && (fromRandom6)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterRANDOM._x, _y:teleporterRANDOM._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 80;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:80, _y:80});
object1._xscale = 25;
object1._yscale = 25;
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:80, _y:180});
object2._xscale = 25;
object2._yscale = 25;
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:80, _y:280});
object3._xscale = 25;
object3._yscale = 25;
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object4", _root.getNextHighestDepth(), {_x:180, _y:80});
object1._xscale = 25;
object1._yscale = 25;
stuff.push(object4);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object5", _root.getNextHighestDepth(), {_x:180, _y:180});
object2._xscale = 25;
object2._yscale = 25;
stuff.push(object5);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object6", _root.getNextHighestDepth(), {_x:180, _y:280});
object3._xscale = 25;
object3._yscale = 25;
stuff.push(object6);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
if (gun < 3) {
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:410, _y:180});
upgrade.push(powerUps);
}
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 24
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 2) {
canAttach = false;
}
if (killed == 2) {
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 2) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side4");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 125) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 250) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(500);
type.push(1);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(500);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(500);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(500);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i]--;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side5");
area = "side5";
fromRandom5 = true;
fromRandom6 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bga", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:285, _y:200});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 60;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 25
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 100) {
canAttach = false;
}
if (killed == 100) {
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 100) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side4");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 125) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 250) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["up", "down"];
randNum = random(2);
setDir = dir[randNum];
switch (setDir) {
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i]--;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side6");
area = "side6";
fromRandom5 = false;
fromRandom6 = true;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:285, _y:200});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 60;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 26
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 25) {
canAttach = false;
}
if (killed == 25) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 25) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area8");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 25) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area10");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 1500) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 700) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(20);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(10);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(10);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area9");
area = 9;
backToArea8 = true;
BbackToArea2 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("background", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:60, _y:350});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:460, _y:50});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (!backToArea9) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (backToArea9) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 120;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:300, _y:80});
object1._xscale = 25;
object1._yscale = 25;
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:400, _y:180});
object2._xscale = 25;
object2._yscale = 25;
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:500, _y:280});
object3._xscale = 25;
object3._yscale = 25;
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object4", _root.getNextHighestDepth(), {_x:200, _y:80});
object1._xscale = 25;
object1._yscale = 25;
stuff.push(object4);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object5", _root.getNextHighestDepth(), {_x:300, _y:180});
object2._xscale = 25;
object2._yscale = 25;
stuff.push(object5);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object6", _root.getNextHighestDepth(), {_x:400, _y:280});
object3._xscale = 25;
object3._yscale = 25;
stuff.push(object6);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 27
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 50) {
canAttach = false;
}
if (killed == 50) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area9");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area11");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function addenemy() {
if ((releaseenemy + 250) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area10");
area = 10;
backToArea9 = true;
BbackToArea3 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("abg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:110, _y:125});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:400, _y:300});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (!BbackToArea2) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (BbackToArea2) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 50;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:300, _y:200});
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 28
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 35) {
canAttach = false;
}
if (killed == 35) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 35) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area10");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 35) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area12");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function addenemy() {
if ((releaseenemy + 80) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "down"];
randNum = random(2);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(20);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area11");
area = 11;
BbackToArea2 = true;
BbackToArea4 = false;
BfromRandom = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("abga", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:450, _y:300});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:450, _y:100});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (!BbackToArea3) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (BbackToArea3) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 70;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:80, _y:80});
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:250, _y:180});
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:120, _y:280});
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 29
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 20) {
canAttach = false;
}
if (killed == 20) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
teleporterRANDOM.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
teleporterRANDOM.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 20) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area11");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 20) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area13");
}
}
if (player.hitTest(teleporterRANDOM._x, teleporterRANDOM._y, true)) {
if (killed == 20) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side7");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 1500) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 700) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(20);
type.push(1);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area12");
area = 12;
BbackToArea3 = true;
BbackToArea5 = false;
BfromRandom2 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("abg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:100, _y:140});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:100, _y:220});
_root.attachMovie("teleporter", "teleporterRANDOM", _root.getNextHighestDepth(), {_x:100, _y:300});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if ((!BbackToArea4) && (!BfromRandom)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (BbackToArea4 && (!BfromRandom)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
if ((!BbackToArea4) && (BfromRandom)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterRANDOM._x, _y:teleporterRANDOM._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 80;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 30
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 5) {
canAttach = false;
}
if (killed == 5) {
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 5) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area12");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 800) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 2) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(40);
type.push(1);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(40);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(40);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(40);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side7");
area = "side7";
BfromRandom = true;
BbackToArea4 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("abga", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:260, _y:200});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 60;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
if (gun < 3) {
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:410, _y:200});
upgrade.push(powerUps);
}
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 31
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 10) {
canAttach = false;
}
if (killed == 10) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
teleporterRANDOM.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
teleporterRANDOM.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 10) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area12");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 10) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area14");
}
}
if (player.hitTest(teleporterRANDOM._x, teleporterRANDOM._y, true)) {
if (killed == 10) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side8");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 700) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 1200) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
type.push(1);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area13");
area = 13;
BbackToArea4 = true;
BbackToArea6 = false;
BfromRandom = false;
BfromRandom3 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:60, _y:190});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:60, _y:350});
_root.attachMovie("teleporter", "teleporterRANDOM", _root.getNextHighestDepth(), {_x:480, _y:50});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if ((!BbackToArea5) && (!BfromRandom2)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (BbackToArea5 && (!BfromRandom2)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
if ((!BfromRandom5) && (BfromRandom2)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterRANDOM._x, _y:teleporterRANDOM._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 160;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:250, _y:250});
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:250, _y:150});
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:250, _y:350});
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object4", _root.getNextHighestDepth(), {_x:250, _y:50});
stuff.push(object4);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 32
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 45) {
canAttach = false;
}
if (killed == 45) {
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 45) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area13");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 3500) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 40) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(10);
type.push(1);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 3000;
randomnumber++;
_root.attachMovie("plusMore", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i]--;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side8");
area = "side8";
BfromRandom2 = true;
BbackToArea5 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:260, _y:200});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 50;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 33
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 50) {
canAttach = false;
}
if (killed == 50) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
teleporterRANDOM.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
teleporterRANDOM.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area13");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area15");
}
}
if (player.hitTest(teleporterRANDOM._x, teleporterRANDOM._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side9");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 700) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 400) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area14");
area = 14;
BbackToArea5 = true;
BbackToArea7 = false;
BfromRandom2 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("abga", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:280, _y:50});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:60, _y:300});
_root.attachMovie("teleporter", "teleporterRANDOM", _root.getNextHighestDepth(), {_x:480, _y:300});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if ((!BbackToArea6) && (!BfromRandom3)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (BbackToArea6 && (!BfromRandom3)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
if ((!BfromRandom6) && (BfromRandom3)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterRANDOM._x, _y:teleporterRANDOM._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 80;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 34
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 70) {
canAttach = false;
}
if (killed == 70) {
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 70) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
redflash.removeMovieClip();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area14");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 250) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 250) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(1);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
redflash.removeMovieClip();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side9");
area = "side9";
BfromRandom3 = true;
BbackToArea6 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bga", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("redflash", "redflash", _root.getNextHighestDepth());
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:280, _y:120});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 60;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
redflash.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 35
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 25) {
canAttach = false;
}
if (killed == 25) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 25) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area14");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 25) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area16");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 1500) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 10) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area15");
area = 15;
BbackToArea6 = true;
BbackToArea8 = false;
BfromRandom3 = false;
BfromRandom4 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("abg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:160, _y:250});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:160, _y:130});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (!BbackToArea7) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (BbackToArea7) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 40;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:300, _y:80});
object1._xscale = 25;
object1._yscale = 25;
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:300, _y:180});
object2._xscale = 25;
object2._yscale = 25;
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:300, _y:280});
object3._xscale = 25;
object3._yscale = 25;
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object7", _root.getNextHighestDepth(), {_x:400, _y:80});
object7._xscale = 25;
object7._yscale = 25;
stuff.push(object7);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object8", _root.getNextHighestDepth(), {_x:400, _y:180});
object8._xscale = 25;
object8._yscale = 25;
stuff.push(object8);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object9", _root.getNextHighestDepth(), {_x:400, _y:280});
object9._xscale = 25;
object9._yscale = 25;
stuff.push(object9);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 36
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 50) {
canAttach = false;
}
if (killed == 50) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
teleporterRANDOM.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
teleporterRANDOM.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
redflash.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area15");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
redflash.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area17");
}
}
if (player.hitTest(teleporterRANDOM._x, teleporterRANDOM._y, true)) {
if (killed == 50) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
redflash.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side10");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 700) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 400) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
redflash.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area16");
area = 16;
BbackToArea7 = true;
BbackToArea9 = false;
BfromRandom5 = false;
BfromRandom6 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("abg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
_root.attachMovie("redflash", "redflash", _root.getNextHighestDepth());
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:280, _y:350});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:60, _y:200});
_root.attachMovie("teleporter", "teleporterRANDOM", _root.getNextHighestDepth(), {_x:480, _y:200});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if ((!BbackToArea8) && (!BfromRandom4)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (BbackToArea8 && (!BfromRandom4)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
if ((!BfromRandom8) && (BfromRandom4)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterRANDOM._x, _y:teleporterRANDOM._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 80;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
_root.attachMovie("object", "object", _root.getNextHighestDepth(), {_x:170, _y:200});
stuff.push(object);
stuffHealth.push(25);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:270, _y:200});
stuff.push(object1);
stuffHealth.push(25);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
redflash.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 37
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 45) {
canAttach = false;
}
if (killed == 45) {
teleporterOUT.gotoAndStop("open");
teleporterIN.gotoAndStop("open");
teleporterRANDOM.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
teleporterRANDOM.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 45) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
redflash.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area16");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 45) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
redflash.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side11");
}
}
if (player.hitTest(teleporterRANDOM._x, teleporterRANDOM._y, true)) {
if (killed == 45) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
redflash.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side12");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 3000) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 100) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
randomnumber++;
enemy_enemy = _root.attachMovie("enemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
type.push(1);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterRANDOM.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side10");
area = "side10";
BfromRandom4 = true;
BbackToArea8 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("abg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
_root.attachMovie("redflash", "redflash", _root.getNextHighestDepth());
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:480, _y:200});
_root.attachMovie("teleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:50, _y:228});
_root.attachMovie("teleporter", "teleporterRANDOM", _root.getNextHighestDepth(), {_x:50, _y:128});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (((!BbackToArea8) && (!BfromRandom5)) && (!BfromRandom6)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (((!BbackToArea8) && (BfromRandom5)) && (!BfromRandom6)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
if (((!BbackToArea8) && (!BfromRandom5)) && (BfromRandom6)) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterRANDOM._x, _y:teleporterRANDOM._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 80;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:80, _y:80});
object1._xscale = 25;
object1._yscale = 25;
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:80, _y:180});
object2._xscale = 25;
object2._yscale = 25;
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:80, _y:280});
object3._xscale = 25;
object3._yscale = 25;
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
if (gun < 4) {
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:410, _y:180});
upgrade.push(powerUps);
}
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
redflash.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 38
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 4) {
canAttach = false;
}
if (killed == 4) {
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 4) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side10");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 125) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 250) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(500);
type.push(1);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(500);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(500);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(500);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i]--;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side11");
area = "side11";
BfromRandom5 = true;
BfromRandom6 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("abga", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:285, _y:200});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 60;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 39
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 100) {
canAttach = false;
}
if (killed == 100) {
teleporterIN.gotoAndStop("open");
} else {
teleporterIN.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 100) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("side10");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 4500) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 250) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["up", "down"];
randNum = random(2);
setDir = dir[randNum];
switch (setDir) {
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(5);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
keyGone = true;
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("side12");
area = "side12";
BfromRandom5 = false;
BfromRandom6 = true;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bga", "background", 1);
_root.attachMovie("fade", "fade", 2);
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:285, _y:200});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 60;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 40
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 25) {
canAttach = false;
}
if (killed == 25) {
teleporterIN.gotoAndStop("open");
if (keyGone) {
teleporterOUT.gotoAndStop("open");
}
} else {
teleporterIN.gotoAndStop("closed");
teleporterOUT.gotoAndStop("closed");
}
if (player.hitTest(teleporterIN._x, teleporterIN._y, true)) {
if (killed == 25) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
redflash.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndStop("area16");
}
}
if (player.hitTest(teleporterOUT._x, teleporterOUT._y, true)) {
if (killed == 25) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
redflash.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
stopAllSounds();
_root.gotoAndStop("fscene");
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local2 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local2 = enemy[i].transform.colorTransform;
_local2.rgb = 4294967295;
enemy[i].transform.colorTransform = _local2;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
endX = _root.phit._x;
endY = _root.phit._y;
enemy[i]._x = enemy[i]._x + ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y + ((endY - enemy[i]._y) / enemySpeed);
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 1500) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if ((releaseenemy + 100) < getTimer()) {
if (canAttach) {
enemyNumber++;
releaseenemy = getTimer();
dir = ["left", "right", "up", "down"];
randNum = random(4);
setDir = dir[randNum];
switch (setDir) {
case "left" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:-30});
enemy.push(enemy_enemy);
enemyHealth.push(20);
type.push(0);
hit.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "right" :
randomnumber++;
enemy_enemy = _root.attachMovie("enemy2", "enemy" + randomnumber, _root.getNextHighestDepth(), {_y:Math.round(Math.random() * 400) + 0, _x:580});
enemy.push(enemy_enemy);
enemyHealth.push(20);
hit.push(0);
type.push(0);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "up" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:-30});
enemy.push(enemy_enemy);
enemyHealth.push(10);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
break;
case "down" :
randomnumber++;
enemy_enemy = _root.attachMovie("senemy", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:Math.round(Math.random() * 550) + 0, _y:430});
enemy.push(enemy_enemy);
enemyHealth.push(10);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
}
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
attachPUP();
score = score + 300;
randomnumber++;
_root.attachMovie("plusTen", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i] = 0;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 10;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
teleporterOUT.removeMovieClip();
player.removeMovieClip();
redflash.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function morestuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(enemiesBullet[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
enemiesBullet[j].removeMovieClip();
enemiesBullet.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("area17");
area = 17;
BbackToArea8 = true;
BbackToArea10 = false;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("abg2", "background", 1);
_root.attachMovie("fade", "fade", 2);
_root.attachMovie("redflash", "redflash", _root.getNextHighestDepth());
fade._alpha = 75;
_root.attachMovie("teleporter", "teleporterIN", _root.getNextHighestDepth(), {_x:60, _y:350});
_root.attachMovie("Fteleporter", "teleporterOUT", _root.getNextHighestDepth(), {_x:460, _y:50});
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
if (!BbackToArea9) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterIN._x, _y:teleporterIN._y});
}
if (BbackToArea9) {
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:teleporterOUT._x, _y:teleporterOUT._y});
}
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 80;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
_root.attachMovie("object", "object1", _root.getNextHighestDepth(), {_x:300, _y:80});
object1._xscale = 25;
object1._yscale = 25;
stuff.push(object1);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object2", _root.getNextHighestDepth(), {_x:400, _y:180});
object2._xscale = 25;
object2._yscale = 25;
stuff.push(object2);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object3", _root.getNextHighestDepth(), {_x:500, _y:280});
object3._xscale = 25;
object3._yscale = 25;
stuff.push(object3);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object4", _root.getNextHighestDepth(), {_x:200, _y:80});
stuff.push(object4);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
_root.attachMovie("object", "object6", _root.getNextHighestDepth(), {_x:400, _y:280});
stuff.push(object6);
stuffHealth.push(50);
stuffDamagedTimer.push(0);
stuffHit.push(0);
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
player.swapDepths(_root.getNextHighestDepth());
fade.swapDepths(_root.getNextHighestDepth());
redflash.swapDepths(_root.getNextHighestDepth());
sound_contr.swapDepths(_root.getNextHighestDepth());
qualityControl.swapDepths(_root.getNextHighestDepth());
lifebar.swapDepths(_root.getNextHighestDepth());
barBoarder.swapDepths(_root.getNextHighestDepth());
swordBar.swapDepths(_root.getNextHighestDepth());
barBoarder3.swapDepths(_root.getNextHighestDepth());
points.swapDepths(_root.getNextHighestDepth());
crosshair.swapDepths(_root.getNextHighestDepth());
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
morestuffshot();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 41
playingG = false;
marker = 0;
Frame 42
onlyOneTime = 0;
playingG = true;
map._alpha = 0;
map._x = 150;
map._y = 75;
map._xscale = 50;
map._yscale = 50;
map._rotation = 90;
map.onEnterFrame = function () {
if (marker > 1) {
marker = 0;
}
if (marker == 0) {
map._alpha = 0;
}
if (marker == 1) {
map._alpha = 80;
}
if (playingG) {
if (!Key.isDown(77)) {
onlyOneTime = 0;
}
if (Key.isDown(77)) {
if (onlyOneTime == 0) {
marker++;
onlyOneTime = 1;
}
}
}
};
function getdistance(x, y, x1, y1) {
var _local2;
var _local3;
_local2 = x1 - x;
_local3 = y1 - y;
return(_root.hyp(_local2, _local3));
}
function hyp(a, b) {
return(Math.sqrt((a * a) + (b * b)));
}
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
playSoundElectricity();
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
function playSoundElectricity() {
var _local1 = random(sound_electricity_array.length);
var _local2 = sound_electricity_array[_local1];
_local2.start();
}
function removeshot() {
i = shot.length - 1;
while (i >= 0) {
shot[i].removeMovieClip();
shot.splice(i, 1);
i--;
}
}
function removePower() {
i = power.length - 1;
while (i >= 0) {
power[i].removeMovieClip();
power.splice(i, 1);
i--;
}
}
function removestuff() {
i = stuff.length - 1;
while (i >= 0) {
stuff[i].removeMovieClip();
stuff.splice(i, 1);
i--;
}
}
function removeenemyReload() {
i = enemyReload.length - 1;
while (i >= 0) {
enemyReload[i].removeMovieClip();
enemyReload.splice(i, 1);
i--;
}
}
function removestuffHealth() {
i = stuffHealth.length - 1;
while (i >= 0) {
stuffHealth[i].removeMovieClip();
stuffHealth.splice(i, 1);
i--;
}
}
function removebomb() {
i = bomb.length - 1;
while (i >= 0) {
bomb[i].removeMovieClip();
bomb.splice(i, 1);
i--;
}
}
function removeupgrade() {
i = upgrade.length - 1;
while (i >= 0) {
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
i--;
}
}
function removeenemy() {
i = enemy.length - 1;
while (i >= 0) {
enemy[i].removeMovieClip();
enemy.splice(i, 1);
i--;
}
}
function removeexplo() {
i = explo.length - 1;
while (i >= 0) {
explo[i].removeMovieClip();
explo.splice(i, 1);
i--;
}
}
function removeenemyHealth() {
i = enemyHealth.length - 1;
while (i >= 0) {
enemyHealth[i].removeMovieClip();
enemyHealth.splice(i, 1);
i--;
}
}
function removestuffHit() {
i = stuffHit.length - 1;
while (i >= 0) {
stuffHit[i].removeMovieClip();
stuffHit.splice(i, 1);
i--;
}
}
function removehit() {
i = hit.length - 1;
while (i >= 0) {
hit[i].removeMovieClip();
hit.splice(i, 1);
i--;
}
}
function removetouchedPlayer() {
i = touchedPlayer.length - 1;
while (i >= 0) {
touchedPlayer[i].removeMovieClip();
touchedPlayer.splice(i, 1);
i--;
}
}
function removedamagedTimer() {
i = damagedTimer.length - 1;
while (i >= 0) {
damagedTimer[i].removeMovieClip();
damagedTimer.splice(i, 1);
i--;
}
}
function removestuffDamagedTimer() {
i = stuffDamagedTimer.length - 1;
while (i >= 0) {
stuffDamagedTimer[i].removeMovieClip();
stuffDamagedTimer.splice(i, 1);
i--;
}
}
function removetype() {
i = type.length - 1;
while (i >= 0) {
type[i].removeMovieClip();
type.splice(i, 1);
i--;
}
}
function removeenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
i--;
}
}
function ereaseBullets() {
i = shot.length - 1;
while (i >= 0) {
if ((((shot[i]._x > 550) or (shot[i]._x < 0)) or (shot[i]._y > 400)) or (shot[i]._y < 0)) {
shot[i].removeMovieClip();
shot.splice(i, 1);
}
i--;
}
}
function ereaseenemiesBullet() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if ((((enemiesBullet[i]._x > 550) or (enemiesBullet[i]._x < 0)) or (enemiesBullet[i]._y > 400)) or (enemiesBullet[i]._y < 0)) {
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
}
i--;
}
}
function setLevel() {
if (enemyNumber == 1) {
canAttach = false;
}
if (killed == 1) {
ended = true;
if (ended) {
if (endedTimer == 45) {
_root.attachMovie("fadeToBlack", "fadeToBlack", _root.getNextHighestDepth());
}
endedTimer--;
if (endedTimer == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
fade.removeMovieClip();
effectHolder_mc.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("completedG");
}
}
}
}
function bulletAlpha() {
i = shot.length - 1;
while (i >= 0) {
if (shot[i].hitTest(player)) {
shot[i]._alpha = 0;
} else {
shot[i]._alpha = 100;
}
i--;
}
}
function hitFollow() {
phit._x = player._x;
phit._y = player._y;
}
function enemymovement() {
i = enemy.length - 1;
while (i >= 0) {
if (hit[i] == 0) {
var _local1 = enemy[i].transform.colorTransform;
enemy[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (hit[i] == 1) {
var _local1 = enemy[i].transform.colorTransform;
_local1.rgb = 4294967295;
enemy[i].transform.colorTransform = _local1;
damagedTimer[i]++;
if (damagedTimer[i] == 1) {
hit[i] = 0;
damagedTimer[i] = 0;
}
}
myRadians = Math.atan2(player._y - enemy[i]._y, player._x - enemy[i]._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
enemy[i]._rotation = myDegrees;
i--;
}
}
function noOverLap() {
i = enemy.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (!(enemy[i] === enemy[j])) {
if (enemy[i].hitTest(enemy[j])) {
endX = _root.enemy[j]._x;
endY = _root.enemy[j]._y;
enemy[i]._x = enemy[i]._x - ((endX - enemy[i]._x) / enemySpeed);
enemy[i]._y = enemy[i]._y - ((endY - enemy[i]._y) / enemySpeed);
}
}
j--;
}
i--;
}
}
function beingHit() {
if (taking_damage) {
if (!playerDead) {
ouch = ouch - 1;
player.gotoAndPlay("hit");
if (ouch == 0) {
taking_damage = false;
ouch = 3;
}
}
}
}
function enemyShooting() {
i = enemy.length - 1;
while (i >= 0) {
if (type[i] == 1) {
if ((enemyReload[i] + 250) < getTimer()) {
enemyReload[i] = getTimer();
randomnumber++;
pullItBullet = _root.attachMovie("rio", "rio" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
enemiesBullet.push(pullItBullet);
angle = enemy[i]._rotation - 90;
pullItBullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
pullItBullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
pullItBullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
i--;
}
}
function addenemy() {
if (doOnce == 0) {
if (canAttach) {
enemyNumber++;
randomnumber++;
enemy_enemy = _root.attachMovie("finalBoss", "enemy" + randomnumber, _root.getNextHighestDepth(), {_x:225, _y:50});
enemy_enemy.onEnterFrame = function () {
if (_root.getdistance(this.x, this.y, this.targx, this.targy) > this.speed) {
this.x = this.x + this.diffx;
this.y = this.y + this.diffy;
} else {
this.x = this.targx;
this.y = this.targy;
if (!this.t) {
this.t = getTimer();
}
if ((getTimer() - this.t) > 100) {
this.reset();
this.t = 0;
}
}
this._x = this.x;
this._y = this.y;
};
enemy.push(enemy_enemy);
enemyHealth.push(6000);
hit.push(0);
type.push(1);
touchedPlayer.push(false);
damagedTimer.push(0);
enemyReload.push(0);
doOnce = 1;
}
}
}
function enemyHealthReachesZero() {
i = enemy.length - 1;
while (i >= 0) {
if (enemyHealth[i] < 1) {
hit_sound.start();
boomTown = _root.attachMovie("explosion5", "boom" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
killed++;
randomnumber++;
blood = _root.attachMovie("splat", "splat" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
if (touchedPlayer[i] == false) {
if (gun < 4) {
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
upgrade.push(powerUps);
}
score = score + 3000;
randomnumber++;
_root.attachMovie("plusMore", "plusTen" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
}
enemy[i].removeMovieClip();
enemy.splice(i, 1);
hit.splice(i, 1);
type.splice(i, 1);
touchedPlayer.splice(i, 1);
damagedTimer.splice(i, 1);
enemyHealth.splice(i, 1);
enemyReload.splice(i, 1);
}
i--;
}
}
function hitdamage() {
i = enemy.length - 1;
while (i >= 0) {
if (phit.hitTest(enemy[i])) {
taking_damage = true;
hit_sound.start();
playerhealth = playerhealth - 10;
touchedPlayer[i] = true;
enemyHealth[i]--;
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function shothitdamage() {
i = enemiesBullet.length - 1;
while (i >= 0) {
if (phit.hitTest(enemiesBullet[i])) {
taking_damage = true;
playerhealth = playerhealth - 15;
enemiesBullet[i].removeMovieClip();
enemiesBullet.splice(i, 1);
if (playerhealth < 0) {
playerhealth = 0;
}
}
i--;
}
}
function collectEnergy() {
i = power.length - 1;
while (i >= 0) {
if (player.hitTest(power[i])) {
blip_sound.start();
energy = energy + 15;
exp = exp + 10;
randomnumber++;
poof = _root.attachMovie("cunt", "explode_pup" + randomnumber, _root.getNextHighestDepth(), {_x:power[i]._x, _y:power[i]._y});
power[i].removeMovieClip();
power.splice(i, 1);
}
i--;
}
}
function playersHealthBar() {
lifebar._xscale = playerhealth;
if (playerhealth < 50) {
lifebar.gotoAndStop("normal");
} else {
lifebar.gotoAndStop("max");
}
}
function playersEnergyBar() {
energy = energy + 1;
if (energy < 0) {
canAttack = false;
energy = 0;
}
if (energy > 100) {
canAttack = true;
energy = 100;
}
swordBar._xscale = energy;
if (!canAttack) {
swordBar.gotoAndStop("normal");
} else {
swordBar.gotoAndStop("max");
}
}
function dead() {
if (playerhealth == 0) {
removeshot();
removePower();
removestuff();
removeenemyReload();
removestuffHealth();
removebomb();
removeexplo();
removeenemy();
removeupgrade();
removeenemyHealth();
removestuffHit();
removehit();
removetouchedPlayer();
removedamagedTimer();
removestuffDamagedTimer();
removetype();
removeenemiesBullet();
effectHolder_mc.removeMovieClip();
fade.removeMovieClip();
swordBar.removeMovieClip();
barBoarder3.removeMovieClip();
crosshair.removeMovieClip();
background.removeMovieClip();
points.removeMovieClip();
phit.removeMovieClip();
teleporterIN.removeMovieClip();
player.removeMovieClip();
lifebar.removeMovieClip();
barBoarder.removeMovieClip();
_root.gotoAndPlay("reset");
}
}
function bombdamage() {
j = explo.length - 1;
while (j >= 0) {
if (phit.hitTest(explo[j])) {
taking_damage = true;
playerhealth = playerhealth - 5;
if (playerhealth < 0) {
playerhealth = 0;
}
}
j--;
}
}
function shaker() {
if (shake == 0) {
_root._x = 0;
_root._y = 0;
} else if (shake == 1) {
shake = shake + 1;
_root._x = _root._x + 3;
_root._y = _root._y + 3;
} else if (shake == 2) {
shake = shake + 1;
_root._y = _root._y - 5;
_root._x = _root._x - 5;
} else if (shake > 2) {
shake = 0;
_root._x = _root._x + 2;
_root._y = _root._y + 2;
}
}
function attachPUP() {
randomnumber++;
pcharge = _root.attachMovie("bell", "bell" + randomnumber, _root.getNextHighestDepth(), {_x:enemy[i]._x, _y:enemy[i]._y});
power.push(pcharge);
}
function shotbybossbombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemiesBullet.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemiesBullet[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function detonatebombs() {
i = bomb.length - 1;
while (i >= 0) {
j = enemy.length - 1;
while (j >= 0) {
if (bomb[i].hitTest(enemy[j])) {
limitbomb--;
hit_sound.start();
shake++;
randomnumber++;
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:bomb[i]._x, _y:bomb[i]._y});
explo.push(bang);
bomb[i].removeMovieClip();
bomb.splice(i, 1);
}
j--;
}
i--;
}
}
function enemyhitbomb() {
i = enemy.length - 1;
while (i >= 0) {
j = explo.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(explo[j])) {
enemyHealth[i] = enemyHealth[i] - 10;
hit[i] = 1;
}
j--;
}
i--;
}
}
function enemyshot() {
i = enemy.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(shot[j])) {
enemyHealth[i]--;
hit[i] = 1;
shot[j].removeMovieClip();
shot.splice(j, 1);
}
j--;
}
i--;
}
}
function enemyshot2() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i].hitTest(spacky)) {
if (gun == 1) {
enemyHealth[i]--;
}
if (gun == 2) {
enemyHealth[i] = enemyHealth[i] - 3;
}
if (gun == 3) {
enemyHealth[i] = enemyHealth[i] - 6;
}
if (gun == 4) {
enemyHealth[i] = enemyHealth[i] - 10;
}
hit[i] = 1;
}
i--;
}
}
function playerCollectPUp() {
i = upgrade.length - 1;
while (i >= 0) {
if (upgrade[i].hitTest(player)) {
blip_sound.start();
randomnumber++;
_root.attachMovie("cfx", "cfx" + randomnumber, _root.getNextHighestDepth(), {_x:upgrade[i]._x, _y:upgrade[i]._y});
gun++;
upgrade[i].removeMovieClip();
upgrade.splice(i, 1);
}
i--;
}
}
function otherstuffshot() {
i = stuff.length - 1;
while (i >= 0) {
if (stuff[i].hitTest(spacky)) {
stuffHit[i] = 1;
if (gun == 1) {
stuffHealth[i]--;
}
if (gun == 2) {
stuffHealth[i] = stuffHealth[i] - 3;
}
if (gun == 3) {
stuffHealth[i] = stuffHealth[i] - 6;
}
if (gun == 4) {
stuffHealth[i] = stuffHealth[i] - 10;
}
if (stuffHealth[i] < 1) {
hit_sound.start();
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
i--;
}
}
function stuffshot() {
i = stuff.length - 1;
while (i >= 0) {
j = shot.length - 1;
while (j >= 0) {
if (stuff[i].hitTest(shot[j])) {
stuffHit[i] = 1;
stuffHealth[i]--;
shot[j].removeMovieClip();
shot.splice(j, 1);
if (stuffHealth[i] < 1) {
hit_sound.start();
randomnumber++;
powerUps = _root.attachMovie("powerUp", "powerUp" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
upgrade.push(powerUps);
bang = _root.attachMovie("explosion", "explosion" + randomnumber, _root.getNextHighestDepth(), {_x:stuff[i]._x, _y:stuff[i]._y});
bang._xscale = 150;
bang._yscale = 150;
stuff[i].removeMovieClip();
stuff.splice(i, 1);
stuffHit.splice(i, 1);
stuffHealth.splice(i, 1);
stuffDamagedTimer.splice(i, 1);
}
}
j--;
}
i--;
}
}
function stuffFlash() {
i = stuff.length - 1;
while (i >= 0) {
if (player.hitTest(stuff[i])) {
if (player._y < stuff[i]._y) {
player._y = player._y - playerSpeed;
}
if (player._y > stuff[i]._y) {
player._y = player._y + playerSpeed;
}
if (player._x < stuff[i]._x) {
player._x = player._x - playerSpeed;
}
if (player._x > stuff[i]._x) {
player._x = player._x + playerSpeed;
}
}
if (stuffHit[i] == 0) {
var _local1 = stuff[i].transform.colorTransform;
stuff[i].transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
if (stuffHit[i] == 1) {
var _local1 = stuff[i].transform.colorTransform;
_local1.rgb = 4294967295;
stuff[i].transform.colorTransform = _local1;
stuffDamagedTimer[i]++;
if (stuffDamagedTimer[i] == 1) {
stuffHit[i] = 0;
stuffDamagedTimer[i] = 0;
}
}
i--;
}
}
function stuffActions() {
i = enemy.length - 1;
while (i >= 0) {
j = stuff.length - 1;
while (j >= 0) {
if (enemy[i].hitTest(stuff[j])) {
if (enemy[i]._y < stuff[j]._y) {
enemy[i]._y = enemy[i]._y - 2.5;
}
if (enemy[i]._y > stuff[j]._y) {
enemy[i]._y = enemy[i]._y + 2.5;
}
if (enemy[i]._x < stuff[j]._x) {
enemy[i]._x = enemy[i]._x - 2.5;
}
if (enemy[i]._x > stuff[j]._x) {
enemy[i]._x = enemy[i]._x + 2.5;
}
}
j--;
}
i--;
}
}
function playeranimations() {
if (!taking_damage) {
if ((((!walkingleft) && (!walkingright)) && (!walkingdown)) && (!walkingup)) {
player.gotoAndStop("idle");
} else {
player.gotoAndPlay("normal");
}
}
}
function bossbounds() {
i = enemy.length - 1;
while (i >= 0) {
if (enemy[i]._x < 30) {
enemy[i]._x = 30;
}
if (enemy[i]._x > 530) {
enemy[i]._x = 530;
}
if (enemy[i]._y < 30) {
enemy[i]._y = 30;
}
if (enemy[i]._y > 370) {
enemy[i]._y = 370;
}
i--;
}
}
function playerbounds() {
if (player._x < 30) {
player._x = 30;
}
if (player._x > 530) {
player._x = 530;
}
if (player._y < 30) {
player._y = 30;
}
if (player._y > 370) {
player._y = 370;
}
}
function chargeUp() {
if (!charging) {
shooting = false;
discharge = 0;
}
if (charging) {
discharge++;
if (discharge > 0) {
shooting = true;
}
}
}
function playershoot() {
if (limitbomb < 5) {
if ((drop + drop_speed) < getTimer()) {
drop = getTimer();
limitbomb++;
randomnumber++;
bomb_bomb = _root.attachMovie("bomb", "bomb" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
bomb.push(bomb_bomb);
}
}
}
function playermovement() {
if (!taking_damage) {
myRadians = Math.atan2(_root._ymouse - player._y, _root._xmouse - player._x);
myDegrees = Math.round((myRadians * 180) / Math.PI) + 90;
player._rotation = myDegrees;
if (Key.isDown(65)) {
player._x = player._x - playerSpeed;
walkingleft = true;
} else {
walkingleft = false;
}
if (Key.isDown(68)) {
player._x = player._x + playerSpeed;
walkingright = true;
} else {
walkingright = false;
}
if (Key.isDown(87)) {
player._y = player._y - playerSpeed;
walkingup = true;
} else {
walkingup = false;
}
if (Key.isDown(83)) {
player._y = player._y + playerSpeed;
walkingdown = true;
} else {
walkingdown = false;
}
}
}
function setGunLimits() {
if (gun == 1) {
lightningBranches = 1;
lightningWidth = 1;
lightningColor = "0x5C98EF";
lightningFrequency = 15;
lightningOffset = 15;
lightningAlpha = 75;
sparkNumber = 3;
sparkDistance = 0;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 2) {
lightningBranches = 3;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 25;
lightningOffset = 10;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 3) {
lightningBranches = 3;
lightningWidth = 5;
lightningColor = "0x5C98EF";
lightningFrequency = 25;
lightningOffset = 25;
lightningAlpha = 75;
sparkNumber = 5;
sparkDistance = 10;
sparkSize = 100;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
spacky._xscale = 25;
spacky._yscale = 25;
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (gun == 4) {
lightningBranches = 10;
lightningWidth = 2;
lightningColor = "0xFFFFFF";
lightningFrequency = 20;
lightningOffset = 60;
lightningAlpha = 100;
sparkNumber = 10;
sparkDistance = 40;
sparkSize = 125;
reloadSpeed = 2;
clearSpeed = 1;
if (canAttack) {
if (shooting) {
energy = energy - 1.3;
randomnumber++;
spacky = _root.attachMovie("spac", "spac" + randomnumber, _root.getNextHighestDepth(), {_x:_root._xmouse, _y:_root._ymouse});
fireWeapon(player._x, player._y, _root._xmouse, _root._ymouse);
}
}
}
if (canAttack) {
if (shooting) {
if (gun == 0) {
if ((timeOfLastShot + 100) < getTimer()) {
timeOfLastShot = getTimer();
ak47_sound.start();
energy = energy - 5;
randomnumber++;
bullet = _root.attachMovie("enemy_shot", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
shot.push(bullet);
angle = player._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (gun < 0) {
gun = 0;
}
if (gun > 4) {
gun = 4;
}
}
function upgrading() {
if (exp > 250) {
addit = 1;
}
if (exp > 1500) {
addit = 2;
}
if (exp > 4000) {
addit = 3;
}
if (exp == 8000) {
addit = 4;
}
if (exp > 8000) {
exp = 8000;
}
if (addit > 4) {
addit = 4;
}
if (addit > 0) {
if (firstup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg1", _root.getNextHighestDepth(), {_x:player._x + 10, _y:player._y + 10});
firstup = 1;
}
upg1._x = player._x + 10;
upg1._y = player._y + 10;
upg1._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot2 + 100) < getTimer()) {
timeOfLastShot2 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg1._x, _y:upg1._y});
shot.push(bullet);
angle = upg1._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 1) {
if (secondup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg2", _root.getNextHighestDepth(), {_x:player._x - 10, _y:player._y - 10});
secondup = 1;
}
upg2._x = player._x - 10;
upg2._y = player._y - 10;
upg2._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot3 + 100) < getTimer()) {
timeOfLastShot3 = getTimer();
randomnumber++;
bullet = _root.attachMovie("yellows", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg2._x, _y:upg2._y});
shot.push(bullet);
angle = upg2._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 2) {
if (thirdup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg3", _root.getNextHighestDepth(), {_x:player._x + 20, _y:player._y + 20});
thirdup = 1;
}
upg3._x = player._x + 20;
upg3._y = player._y + 20;
upg3._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot4 + 250) < getTimer()) {
timeOfLastShot4 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg3._x, _y:upg3._y});
shot.push(bullet);
angle = upg3._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
if (addit > 3) {
if (fourthup == 0) {
_root.attachMovie("lvluptxt", "lvluptxt", _root.getNextHighestDepth());
_root.attachMovie("upg1", "upg4", _root.getNextHighestDepth(), {_x:player._x - 20, _y:player._y - 20});
fourthup = 1;
}
upg4._x = player._x - 20;
upg4._y = player._y - 20;
upg4._rotation = player._rotation;
if (canAttack) {
if (shooting) {
if ((timeOfLastShot5 + 250) < getTimer()) {
timeOfLastShot5 = getTimer();
randomnumber++;
bullet = _root.attachMovie("greens", "enemy_shot" + randomnumber, _root.getNextHighestDepth(), {_x:upg4._x, _y:upg4._y});
shot.push(bullet);
angle = upg4._rotation - 90;
bullet.dirx = Math.cos((angle * Math.PI) / 180) * 15;
bullet.diry = Math.sin((angle * Math.PI) / 180) * 15;
bullet.onEnterFrame = function () {
this._x = this._x + this.dirx;
this._y = this._y + this.diry;
};
}
}
}
}
}
stop();
map.gotoAndStop("exit");
area = "bossEncounter";
doOnce = 0;
ended = false;
endedTimer = 45;
Mouse.hide();
blip_sound = new Sound();
blip_sound.attachSound("blip");
ak47_sound = new Sound();
ak47_sound.attachSound("ak47");
shunkanido_sound = new Sound();
shunkanido_sound.attachSound("shunkanido");
hit_sound = new Sound();
hit_sound.attachSound("hit.mp3");
_root.attachMovie("bg3", "background", 1);
fade._alpha = 75;
_root.attachMovie("effectHolder_mc", "effectHolder_mc", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:225, _y:380});
_root.attachMovie("phit", "phit", _root.getNextHighestDepth());
phit._alpha = 0;
_root.attachMovie("healthBar", "lifebar", _root.getNextHighestDepth(), {_x:5, _y:20});
_root.attachMovie("barBoarder", "barBoarder", _root.getNextHighestDepth(), {_x:3, _y:20});
attachMovie("crosshair", "crosshair", _root.getNextHighestDepth());
_root.attachMovie("points", "points", _root.getNextHighestDepth(), {_x:300, _y:0});
_root.attachMovie("swordBar", "swordBar", _root.getNextHighestDepth(), {_x:160, _y:20});
swordBar.gotoAndStop("max");
_root.attachMovie("barBoarder3", "barBoarder3", _root.getNextHighestDepth(), {_x:160, _y:20});
walkingleft = false;
walkingright = false;
walkingup = false;
walkingdown = false;
shooting = false;
taking_damage = false;
timeOfLastShot2 = 0;
timeOfLastShot3 = 0;
timeOfLastShot4 = 0;
timeOfLastShot5 = 0;
ouch = 3;
killed = 0;
canAttach = true;
enemyNumber = 0;
randomnumber = 0;
playerhealth = 100;
limitbomb = 0;
timeOfLastShot = 0;
timeOfLastSwing = 0;
playerSpeed = 10;
enemySpeed = 250;
bomb_speed = 15;
drop = 0;
drop_speed = 300;
releaseenemy = 0;
shake = 0;
enterBoss = 0;
discharge = 0;
canAttack = true;
energy = 100;
charging = false;
var bomb = new Array();
var enemiesBullet = new Array();
var shot = new Array();
var enemy = new Array();
var explo = new Array();
var power = new Array();
var enemyHealth = new Array();
var touchedPlayer = new Array();
var damagedTimer = new Array();
var hit = new Array();
var stuffDamagedTimer = new Array();
var stuffHit = new Array();
var type = new Array();
var upgrade = new Array();
var stuff = new Array();
var stuffHealth = new Array();
var enemyReload = new Array();
MovieClip.prototype.reset = function () {
width = 550;
height = 400;
var _local4;
var _local3;
this.x = this._x;
this.y = this._y;
this.speed = 10;
this.targx = Math.random() * width;
this.targy = Math.random() * height;
_local4 = _root.getdistance(this.x, this.y, this.targx, this.targy);
_local3 = this.speed / _local4;
this.diffx = (this.targx - this.x) * _local3;
this.diffy = (this.targy - this.y) * _local3;
};
var lightningOffset = 50;
var lightningFrequency = 25;
var lightningWidth = 2;
var lightningColor = "0x5C98EF";
var lightningAlpha = 50;
var lightningBranches = 10;
var sparkNumber = 50;
var sparkDistance = 40;
var sparkSize = 120;
var reloadSpeed = 500;
var clearSpeed = 250;
var glow_color = lightningColor;
var glow_alpha = 0.6;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 2;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var sound_electricity_array = Array();
var elec_damage_1_snd = new Sound();
elec_damage_1_snd.attachSound("elec_damage_1");
sound_electricity_array.push(elec_damage_1_snd);
var elec_damage_2_snd = new Sound();
elec_damage_2_snd.attachSound("elec_damage_2");
sound_electricity_array.push(elec_damage_2_snd);
var elec_damage_3_snd = new Sound();
elec_damage_3_snd.attachSound("elec_damage_3");
sound_electricity_array.push(elec_damage_3_snd);
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
crosshair.onEnterFrame = function () {
this._x = _xmouse;
this._y = _ymouse;
};
onMouseDown = function () {
charging = true;
};
onMouseUp = function () {
charging = false;
};
player.onEnterFrame = function () {
map.swapDepths(_root.getNextHighestDepth());
points.pts.text = score;
barBoarder.exps.text = exp;
upgrading();
setLevel();
playermovement();
playerbounds();
detonatebombs();
playersHealthBar();
hitdamage();
shothitdamage();
addenemy();
playeranimations();
enemymovement();
noOverLap();
enemyhitbomb();
shaker();
dead();
ereaseBullets();
ereaseenemiesBullet();
bulletAlpha();
enemyshot();
beingHit();
hitFollow();
meleeAttack();
chargeUp();
playersEnergyBar();
collectEnergy();
enemyHealthReachesZero();
enemyshot2();
stuffActions();
stuffshot();
stuffFlash();
otherstuffshot();
playerCollectPUp();
setGunLimits();
enemyShooting();
bossbounds();
shotbybossbombs();
};
qualityControl.onEnterFrame = function () {
if (Key.isDown(81)) {
if (num == 0) {
qset++;
num = 1;
}
} else {
num = 0;
}
if (qset == 0) {
qualityControl.qual.text = "High";
_quality = "high";
}
if (qset == 1) {
qualityControl.qual.text = "Medium";
_quality = "medium";
}
if (qset == 2) {
qualityControl.qual.text = "Low";
_quality = "low";
}
if (qset > 2) {
qset = 0;
}
};
Frame 43
playingG = false;
marker = 0;
getURL ("http://www.xdgames.co.uk", "_blank");
stopAllSounds();
Mouse.show();
var o = {n:[12, 2, 6, 8, 8, 6, 15, 13, 15, 12, 14, 7, 10, 14, 11, 7], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:score});
Frame 44
stop();
Instance of Symbol 400 MovieClip "xdq" in Frame 44
on (press) {
getURL ("http://www.xdgames.co.uk", "_blank");
}
Symbol 463 MovieClip [__Packages.mochi.as2.MochiSync] Frame 0
class mochi.as2.MochiSync
{
var _syncContainer;
function MochiSync () {
_syncContainer = {};
}
function getProp(name) {
return(_syncContainer[name]);
}
function setProp(name, value) {
if (_syncContainer[name] == value) {
return(undefined);
}
_syncContainer[name] = value;
mochi.as2.MochiServices.send("sync_propUpdate", {name:name, value:value});
}
function triggerEvent(eventType, args) {
switch (eventType) {
case SYNC_REQUEST :
mochi.as2.MochiServices.send("sync_syncronize", _syncContainer);
break;
case SYNC_PROPERTY :
_syncContainer[args.name] = args.value;
}
}
static var SYNC_REQUEST = "SyncRequest";
static var SYNC_PROPERTY = "UpdateProperty";
}
Symbol 464 MovieClip [__Packages.mochi.as2.MochiServices] Frame 0
class mochi.as2.MochiServices
{
static var _id, _container, _clip, _sendChannelName, __get__comChannelName, onError, _listenChannel, _sendChannel;
function MochiServices () {
}
static function get id() {
return(_id);
}
static function get clip() {
return(_container);
}
static function get childClip() {
return(_clip);
}
static function getVersion() {
return("3.3 as2");
}
static function allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function get isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function set comChannelName(val) {
if (val != undefined) {
if (val.length > 3) {
_sendChannelName = val + "_fromgame";
initComChannels();
}
}
//return(__get__comChannelName());
}
static function get connected() {
return(_connected);
}
static function connect(id, clip, onError) {
warnID(id, false);
if ((!_connected) && (_clip == undefined)) {
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
}
if (onError != undefined) {
mochi.as2.MochiServices.onError = onError;
} else if (mochi.as2.MochiServices.onError == undefined) {
mochi.as2.MochiServices.onError = function (errorCode) {
trace(errorCode);
};
}
}
static function disconnect() {
if (_connected || (_connecting)) {
_connecting = (_connected = false);
flush(true);
if (_clip != undefined) {
_clip.removeMovieClip();
delete _clip;
}
_listenChannel.close();
}
}
static function init(id, clip) {
_id = id;
if (clip != undefined) {
_container = clip;
} else {
_container = _root;
}
loadCommunicator(id, _container);
}
static function loadCommunicator(id, clip) {
var _local6 = "_mochiservices_com_" + id;
var _local5 = new MovieClipLoader();
var _local3 = {};
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
if (urlOptions().servURL) {
_servURL = urlOptions().servURL;
}
var _local4 = _servURL + _services;
if (urlOptions().servicesURL) {
_local4 = urlOptions().servicesURL;
}
allowDomains(_local4);
_clip = clip.createEmptyMovieClip(_local6, 10336, false);
_listenChannelName = _listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor(Math.random() * 99999));
listen();
if (_local3.waitInterval != null) {
clearInterval(_local3.waitInterval);
}
_local3.onLoadError = loadError;
_local3.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_local3.startTime = getTimer();
_local3.wait = function () {
if ((getTimer() - this.startTime) > 10000) {
if (!this.isLoading) {
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_local3.waitInterval = setInterval(_local3, "wait", 1000);
_local5.addListener(_local3);
_local5.loadClip((((((_local4 + "?listenLC=") + _listenChannelName) + "&mochiad_options=") + escape(_root.mochiad_options)) + "&api_version=") + getVersion(), _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
return(_clip);
}
static function loadError(target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
disconnect();
onError.apply(null, [errorCode]);
}
static function onStatus(infoObject) {
if (!(infoObject.level === "error")) {
} else {
_connected = false;
_listenChannel.connect(_listenChannelName);
}
}
static function listen() {
_listenChannel = new LocalConnection();
_listenChannel.handshake = function (args) {
mochi.as2.MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel._nextcallbackID = 0;
_listenChannel._callbacks = {};
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_clip, version:getVersion()});
_listenChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_listenChannel.onReceive = function (pkg) {
var _local5 = pkg.callbackID;
var _local4 = this._callbacks[_local5];
if (!_local4) {
return(undefined);
}
var _local2 = _local4.callbackMethod;
var _local3 = _local4.callbackObject;
if (_local3 && (typeof(_local2) == "string")) {
_local2 = _local3[_local2];
}
if (_local2 != undefined) {
_local2.apply(_local3, pkg.args);
}
delete this._callbacks[_local5];
};
_listenChannel.onEvent = function (pkg) {
switch (pkg.target) {
case "events" :
mochi.as2.MochiEvents.triggerEvent(pkg.event, pkg.args);
break;
case "coins" :
mochi.as2.MochiCoins.triggerEvent(pkg.event, pkg.args);
break;
case "sync" :
mochi.as2.MochiServices.servicesSync.triggerEvent(pkg.event, pkg.args);
}
};
_listenChannel.onError = function () {
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
};
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function flush(error) {
var _local1;
var _local2;
while (_sendChannel._queue.length > 0) {
_local1 = _sendChannel._queue.shift();
if (_local1.callbackID != null) {
_local2 = _listenChannel._callbacks[_local1.callbackID];
}
delete _listenChannel._callbacks[_local1.callbackID];
if (error) {
handleError(_local1.args, _local2.callbackObject, _local2.callbackMethod);
}
}
}
static function handleError(args, callbackObject, callbackMethod) {
if (args != null) {
if (args.onError != null) {
args.onError.apply(null, ["NotConnected"]);
}
if ((args.options != null) && (args.options.onError != null)) {
args.options.onError.apply(null, ["NotConnected"]);
}
}
if (callbackMethod != null) {
args = {};
args.error = true;
args.errorCode = "NotConnected";
if ((callbackObject != null) && (typeof(callbackMethod) == "string")) {
callbackObject[callbackMethod](args);
} else if (callbackMethod != null) {
callbackMethod.apply(args);
}
}
}
static function send(methodName, args, callbackObject, callbackMethod) {
if (_connected) {
_sendChannel.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
} else {
if ((_clip == undefined) || (!_connecting)) {
trace("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + methodName);
handleError(args, callbackObject, callbackMethod);
flush(true);
return(undefined);
}
_sendChannel._queue.push({methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
}
_listenChannel._callbacks[_listenChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_listenChannel._nextcallbackID++;
}
static function urlOptions() {
var _local5 = {};
var _local6;
if (_root._url.indexOf("mochiad_options") != -1) {
var _local2 = (_root._url.indexOf("mochiad_options") + "mochiad_options".length) + 1;
_local6 = _root._url.substr(_local2, _root._url.length);
} else if (_root.mochiad_options) {
_local6 = _root.mochiad_options;
}
if (_local6) {
var _local4 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2].split("=");
_local5[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local5);
}
static function warnID(bid, leaderboard) {
bid = bid.toLowerCase();
if (bid.length != 16) {
trace(("WARNING: " + (leaderboard ? "board" : "game")) + " ID is not the appropriate length");
return(undefined);
}
if (bid == "1e113c7239048b3f") {
if (leaderboard) {
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
}
return(undefined);
}
if (bid == "84993a1de4031cd8") {
if (leaderboard) {
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
}
return(undefined);
}
var _local1 = 0;
while (_local1 < bid.length) {
switch (bid.charAt(_local1)) {
case "0" :
case "1" :
case "2" :
case "3" :
case "4" :
case "5" :
case "6" :
case "7" :
case "8" :
case "9" :
case "a" :
case "b" :
case "c" :
case "d" :
case "e" :
case "f" :
break;
default :
trace("WARNING: Board ID contains illegal characters: " + bid);
return(undefined);
}
_local1++;
}
}
static function addLinkEvent(url, burl, btn, onClick) {
var timeout = 1500;
var t0 = getTimer();
var _local2 = new Object();
_local2.mav = getVersion();
_local2.swfv = btn.getSWFVersion() || 6;
_local2.swfurl = btn._url;
_local2.fv = System.capabilities.version;
_local2.os = System.capabilities.os;
_local2.lang = System.capabilities.language;
_local2.scres = (System.capabilities.screenResolutionX + "x") + System.capabilities.screenResolutionY;
var s = "?";
var _local3 = 0;
for (var _local6 in _local2) {
if (_local3 != 0) {
s = s + "&";
}
_local3++;
s = ((s + _local6) + "=") + escape(_local2[_local6]);
}
if (!(netupAttempted || (_connected))) {
var ping = btn.createEmptyMovieClip("ping", 777);
var _local7 = btn.createEmptyMovieClip("nettest", 778);
netupAttempted = true;
ping.loadMovie("http://x.mochiads.com/linkping.swf?t=" + getTimer());
_local7.onEnterFrame = function () {
if ((ping._totalframes > 0) && (ping._totalframes == ping._framesloaded)) {
delete this.onEnterFrame;
} else if ((getTimer() - t0) > timeout) {
delete this.onEnterFrame;
mochi.as2.MochiServices.netup = false;
}
};
}
var _local4 = btn.createEmptyMovieClip("clk", 1001);
_local4._alpha = 0;
_local4.beginFill(1044735);
_local4.moveTo(0, 0);
_local4.lineTo(0, btn._height);
_local4.lineTo(btn._width, btn._height);
_local4.lineTo(btn._width, 0);
_local4.lineTo(0, 0);
_local4.endFill();
_local4.onRelease = function () {
if (mochi.as2.MochiServices.netup) {
getURL (url + s, "_blank");
} else {
getURL (burl, "_blank");
}
if (onClick != undefined) {
onClick();
}
};
}
static function setContainer(clip) {
}
static function stayOnTop(clip) {
}
static var _servURL = "http://www.mochiads.com/static/lib/services/";
static var _services = "services.swf";
static var _mochiLC = "MochiLC.swf";
static var _listenChannelName = "__ms_";
static var _connecting = false;
static var _connected = false;
static var netup = true;
static var netupAttempted = false;
static var servicesSync = new mochi.as2.MochiSync();
}
Symbol 465 MovieClip [__Packages.mochi.as2.MochiEventDispatcher] Frame 0
class mochi.as2.MochiEventDispatcher
{
var eventTable;
function MochiEventDispatcher () {
eventTable = {};
}
function buildDelegate(thisObject, thatObject) {
var _local2 = {thisObject:thisObject, thatObject:thatObject};
if (thatObject != undefined) {
var funct = ((typeof(thatObject) == "string") ? (thisObject[thatObject]) : (thatObject));
_local2.delegate = function (args) {
funct.call(thisObject, args);
};
} else {
_local2.delegate = thisObject;
}
return(_local2);
}
function compareDelegate(d_A, d_B) {
if ((d_A.thisObject != d_B.thisObject) || (d_A.thatObject != d_B.thatObject)) {
return(false);
}
return(true);
}
function addEventListener(event, thisObject, thatObject) {
removeEventListener(event, thisObject, thatObject);
eventTable[event].push(buildDelegate(thisObject, thatObject));
}
function removeEventListener(event, thisObject, thatObject) {
var _local3 = buildDelegate(thisObject, thatObject);
if (eventTable[event] == undefined) {
eventTable[event] = [];
return(undefined);
}
for (var _local4 in eventTable[event]) {
if (!compareDelegate(eventTable[event][_local4], _local3)) {
continue;
}
eventTable[event].splice(Number(_local4), 1);
}
}
function triggerEvent(event, args) {
if (eventTable[event] == undefined) {
return(undefined);
}
for (var _local4 in eventTable[event]) {
eventTable[event][_local4].delegate(args);
}
}
}
Symbol 466 MovieClip [__Packages.mochi.as2.MochiEvents] Frame 0
class mochi.as2.MochiEvents
{
static var gameStart, levelStart;
function MochiEvents () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function startSession(achievementID) {
mochi.as2.MochiServices.send("events_beginSession", {achievementID:achievementID}, null, null);
}
static function trigger(kind, obj) {
if (obj == undefined) {
obj = {};
} else if (obj.kind != undefined) {
trace("WARNING: optional arguements package contains key 'id', it will be overwritten");
obj.kind = kind;
}
mochi.as2.MochiServices.send("events_triggerEvent", {eventObject:obj}, null, null);
}
static function setNotifications(clip, style) {
var _local2 = {};
for (var _local3 in style) {
_local2[_local3] = style[_local3];
}
_local2.clip = clip;
mochi.as2.MochiServices.send("events_setNotifications", _local2, null, null);
}
static function addEventListener(eventType, thisObject, thatObject) {
_dispatcher.addEventListener(eventType, thisObject, thatObject);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, thisObject, thatObject) {
_dispatcher.removeEventListener(eventType, thisObject, thatObject);
}
static function startGame() {
gameStart = new Date().getTime();
trigger("start_game");
}
static function endGame() {
var _local1 = new Date().getTime() - gameStart;
trigger("end_game", {time:_local1});
}
static function startLevel() {
levelStart = new Date().getTime();
trigger("start_level");
}
static function endLevel() {
var _local1 = new Date().getTime() - levelStart;
trigger("end_level", {time:_local1});
}
static var ACHIEVEMENT_RECEIVED = "AchievementReceived";
static var ALIGN_TOP_LEFT = "ALIGN_TL";
static var ALIGN_TOP = "ALIGN_T";
static var ALIGN_TOP_RIGHT = "ALIGN_TR";
static var ALIGN_LEFT = "ALIGN_L";
static var ALIGN_CENTER = "ALIGN_C";
static var ALIGN_RIGHT = "ALIGN_R";
static var ALIGN_BOTTOM_LEFT = "ALIGN_BL";
static var ALIGN_BOTTOM = "ALIGN_B";
static var ALIGN_BOTTOM_RIGHT = "ALIGN_BR";
static var FORMAT_SHORT = "ShortForm";
static var FORMAT_LONG = "LongForm";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 467 MovieClip [__Packages.mochi.as2.MochiCoins] Frame 0
class mochi.as2.MochiCoins
{
function MochiCoins () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function showStore(options) {
mochi.as2.MochiServices.send("coins_showStore", {options:options}, null, null);
}
static function showItem(options) {
if ((options == undefined) || (typeof(options.item) != "string")) {
trace("ERROR: showItem call must pass an Object with an item key");
return(undefined);
}
mochi.as2.MochiServices.send("coins_showItem", {options:options}, null, null);
}
static function showVideo(options) {
if ((options == undefined) || (typeof(options.item) != "string")) {
trace("ERROR: showVideo call must pass an Object with an item key");
return(undefined);
}
mochi.as2.MochiServices.send("coins_showVideo", {options:options}, null, null);
}
static function showLoginWidget(options) {
mochi.as2.MochiServices.setContainer();
mochi.as2.MochiServices.stayOnTop();
mochi.as2.MochiServices.send("coins_showLoginWidget", {options:options});
}
static function hideLoginWidget() {
mochi.as2.MochiServices.send("coins_hideLoginWidget");
}
static function getStoreItems() {
mochi.as2.MochiServices.send("coins_getStoreItems");
}
static function getUserInfo() {
mochi.as2.MochiServices.send("coins_getUserInfo");
}
static function saveUserProperties(properties) {
mochi.as2.MochiServices.send("coins_saveUserProperties", properties);
}
static function addEventListener(eventType, delegate) {
_dispatcher.addEventListener(eventType, delegate);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, delegate) {
_dispatcher.removeEventListener(eventType, delegate);
}
static var LOGGED_IN = "LoggedIn";
static var LOGGED_OUT = "LoggedOut";
static var LOGIN_SHOW = "LoginShow";
static var LOGIN_HIDE = "LoginHide";
static var STORE_SHOW = "StoreShow";
static var STORE_HIDE = "StoreHide";
static var PROFILE_SHOW = "ProfileShow";
static var PROFILE_HIDE = "ProfileHide";
static var PROPERTIES_SAVED = "PropertySaved";
static var WIDGET_LOADED = "WidgetLoaded";
static var ITEM_OWNED = "ItemOwned";
static var ITEM_NEW = "ItemNew";
static var STORE_ITEMS = "StoreItems";
static var USER_INFO = "UserInfo";
static var ERROR = "Error";
static var IO_ERROR = "IOError";
static var NO_USER = "NoUser";
static var PROPERTIES_SIZE = "PropertiesSize";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 468 MovieClip [__Packages.mochi.as2.MochiScores] Frame 0
class mochi.as2.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.as2.MochiServices.warnID(boardID, true);
mochi.as2.MochiScores.boardID = boardID;
mochi.as2.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
options.clip = mochi.as2.MochiServices.clip;
if ((options.clip != mochi.as2.MochiServices.__get__clip()) || (mochi.as2.MochiServices.__get__childClip()._target == undefined)) {
mochi.as2.MochiServices.disconnect();
trace("WARNING! This application is attempting to connect to MochiServices inside a showLeaderboard call!");
trace("make sure MochiServices.connect is called as early in the application runtime as possible.");
mochi.as2.MochiServices.connect(mochi.as2.MochiServices.__get__id(), options.clip);
}
delete options.clip;
if (options.name != null) {
if (typeof(options.name) == "object") {
if (options.name.text != undefined) {
options.name = options.name.text;
}
}
}
if (options.score != null) {
if (options.score instanceof TextField) {
if (options.score.text != undefined) {
options.score = options.score.text;
}
} else if (options.score instanceof mochi.as2.MochiDigits) {
options.score = options.score.value;
}
var _local1 = Number(options.score);
if (isNaN(_local1)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'");
} else if ((_local1 == Number.NEGATIVE_INFINITY) || (_local1 == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(_local1) != _local1) {
trace(("WARNING: Submitted score '" + options.score) + "' will be truncated");
}
options.score = _local1;
}
}
if (options.onDisplay != null) {
options.onDisplay();
} else {
mochi.as2.MochiServices.__get__clip().stop();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
mochi.as2.MochiServices.__get__clip().play();
};
}
if (options.onError != null) {
onError = options.onError;
} else {
onError = onClose;
}
if (options.boardID == null) {
if (boardID != null) {
options.boardID = boardID;
}
}
mochi.as2.MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
mochi.as2.MochiServices.send("scores_showLeaderboard", {options:options}, null, doClose);
}
static function closeLeaderboard() {
mochi.as2.MochiServices.send("scores_closeLeaderboard");
}
static function getPlayerInfo(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
static function submit(score, name, callbackObj, callbackMethod) {
score = Number(score);
if (isNaN(score)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is 'Not a Number'");
} else if ((score == Number.NEGATIVE_INFINITY) || (score == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(score) != score) {
trace(("WARNING: Submitted score '" + String(score)) + "' will be truncated");
}
score = Number(score);
}
mochi.as2.MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
static function requestList(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_requestList", null, callbackObj, callbackMethod);
}
static function scoresArrayToObjects(scores) {
var _local5 = {};
var _local1;
var _local4;
var _local2;
var _local6;
for (var _local8 in scores) {
if (typeof(scores[_local8]) == "object") {
if ((scores[_local8].cols != null) && (scores[_local8].rows != null)) {
_local5[_local8] = [];
_local2 = scores[_local8];
_local4 = 0;
while (_local4 < _local2.rows.length) {
_local6 = {};
_local1 = 0;
while (_local1 < _local2.cols.length) {
_local6[_local2.cols[_local1]] = _local2.rows[_local4][_local1];
_local1++;
}
_local5[_local8].push(_local6);
_local4++;
}
} else {
_local5[_local8] = {};
for (var _local7 in scores[_local8]) {
_local5[_local8][_local7] = scores[_local8][_local7];
}
}
} else {
_local5[_local8] = scores[_local8];
}
}
return(_local5);
}
static function doClose(args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = "IOError";
}
onError.apply(null, [args.errorCode]);
} else {
onClose.apply();
}
}
}
Symbol 469 MovieClip [__Packages.mochi.as2.MochiDigits] Frame 0
class mochi.as2.MochiDigits
{
var Encoder, Fragment, Sibling;
function MochiDigits (digit, index) {
Encoder = 0;
setValue(digit, index);
}
function get value() {
return(Number(toString()));
}
function set value(v) {
setValue(v);
//return(value);
}
function addValue(v) {
value = value + v;
}
function setValue(digit, index) {
var _local3 = digit.toString();
if ((index == undefined) || (isNaN(index))) {
index = 0;
}
Fragment = _local3.charCodeAt(index++) ^ Encoder;
if (index < _local3.length) {
Sibling = new mochi.as2.MochiDigits(digit, index);
} else {
Sibling = null;
}
reencode();
}
function reencode() {
var _local2 = int(2147483647 * Math.random());
Fragment = Fragment ^ (_local2 ^ Encoder);
Encoder = _local2;
}
function toString() {
var _local2 = String.fromCharCode(Fragment ^ Encoder);
return(((Sibling != null) ? (_local2.concat(Sibling.toString())) : (_local2)));
}
}
Symbol 58 MovieClip [player] Frame 1
stop();
Symbol 58 MovieClip [player] Frame 2
stop();
Symbol 58 MovieClip [player] Frame 3
stop();
Symbol 110 MovieClip [explosion] Frame 26
this.removeMovieClip();
Symbol 113 MovieClip [healthBar] Frame 1
stop();
Symbol 113 MovieClip [healthBar] Frame 2
stop();
Symbol 139 MovieClip Frame 12
stop();
Symbol 142 Button
on (release) {
gotoAndPlay (2);
_root.soundstatus = "off";
}
Symbol 143 MovieClip Frame 11
stop();
Symbol 145 Button
on (release) {
gotoAndPlay (1);
_root.soundstatus = "on";
}
Symbol 146 MovieClip Frame 1
stop();
Symbol 146 MovieClip Frame 2
stop();
Instance of Symbol 150 MovieClip in Symbol 151 MovieClip [sound_contr] 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 155 MovieClip [plusTen] Frame 41
this.removeMovieClip();
Symbol 160 MovieClip [swordBar] Frame 1
stop();
Symbol 160 MovieClip [swordBar] Frame 2
stop();
Symbol 168 MovieClip [bell] Frame 61
this.removeMovieClip();
Symbol 170 MovieClip [cunt] Frame 30
this.removeMovieClip();
Symbol 182 MovieClip [teleporter] Frame 1
stop();
Symbol 182 MovieClip [teleporter] Frame 2
stop();
Symbol 183 MovieClip [spark] Frame 16
this.removeMovieClip();
Symbol 184 MovieClip [spark2] Frame 16
this.removeMovieClip();
Symbol 187 MovieClip [spac] Frame 13
this.removeMovieClip();
Symbol 224 MovieClip [cfx] Frame 23
this.removeMovieClip();
Symbol 253 MovieClip [plusMore] Frame 41
this.removeMovieClip();
Symbol 270 MovieClip [Fteleporter] Frame 1
stop();
Symbol 270 MovieClip [Fteleporter] Frame 2
stop();
Symbol 277 MovieClip [fadeToBlack] Frame 46
this.removeMovieClip();
Symbol 278 MovieClip [explosion5] Frame 26
this.removeMovieClip();
Symbol 300 MovieClip [lvluptxt] Frame 50
this.removeMovieClip();
Symbol 338 MovieClip [map] Frame 1
stop();
Symbol 338 MovieClip [map] Frame 2
stop();
Symbol 338 MovieClip [map] Frame 3
stop();
Symbol 338 MovieClip [map] Frame 4
stop();
Symbol 338 MovieClip [map] Frame 5
stop();
Symbol 338 MovieClip [map] Frame 6
stop();
Symbol 338 MovieClip [map] Frame 7
stop();
Symbol 338 MovieClip [map] Frame 8
stop();
Symbol 338 MovieClip [map] Frame 9
stop();
Symbol 338 MovieClip [map] Frame 10
stop();
Symbol 338 MovieClip [map] Frame 11
stop();
Symbol 338 MovieClip [map] Frame 12
stop();
Symbol 338 MovieClip [map] Frame 13
stop();
Symbol 338 MovieClip [map] Frame 14
stop();
Symbol 338 MovieClip [map] Frame 15
stop();
Symbol 338 MovieClip [map] Frame 16
stop();
Symbol 338 MovieClip [map] Frame 17
stop();
Symbol 338 MovieClip [map] Frame 18
stop();
Symbol 338 MovieClip [map] Frame 19
stop();
Symbol 338 MovieClip [map] Frame 20
stop();
Symbol 338 MovieClip [map] Frame 21
stop();
Symbol 338 MovieClip [map] Frame 22
stop();
Symbol 338 MovieClip [map] Frame 23
stop();
Symbol 338 MovieClip [map] Frame 24
stop();
Symbol 338 MovieClip [map] Frame 25
stop();
Symbol 338 MovieClip [map] Frame 26
stop();
Symbol 338 MovieClip [map] Frame 27
stop();
Symbol 338 MovieClip [map] Frame 28
stop();
Symbol 338 MovieClip [map] Frame 29
play();
Symbol 338 MovieClip [map] Frame 30
stop();
Symbol 345 MovieClip Frame 5
stop();
Symbol 350 MovieClip Frame 10
stop();
Symbol 353 MovieClip Frame 5
stop();
Symbol 362 MovieClip Frame 30
stop();
Symbol 363 MovieClip Frame 1
_root.stop();
Symbol 363 MovieClip Frame 175
_root.play();
stopAllSounds();
Symbol 365 MovieClip Frame 1
_root.stop();
Symbol 365 MovieClip Frame 1043
_root.play();
Symbol 368 Button
on (release) {
gotoAndStop ("title");
}
Symbol 403 MovieClip Frame 20
stop();
Symbol 407 MovieClip Frame 20
stop();
Symbol 410 MovieClip Frame 20
stop();
Symbol 412 MovieClip Frame 20
stop();
Symbol 420 MovieClip Frame 1
_root.stop();
Symbol 420 MovieClip Frame 41
_root.play();
Symbol 452 MovieClip Frame 1
_root.stop();
Symbol 452 MovieClip Frame 111
_root.play();
Symbol 460 Button
on (release) {
gotoAndStop ("title");
}
Symbol 462 MovieClip Frame 21
stop();