STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228090
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2561 · P5121

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/64878951?noj=FRM64878951-4DC" width="1" height="1"></div>

One vs Many - frantic top down shooter.swf

This is the info page for
Flash #90404

(Click the ID number above for more basic data on this flash file.)


Text
Loading....

Just Loading

Please wait

Health

Exp:

<p align="left"><font face="_sans" size="12" color="#ffffff" letterSpacing="5.000000" kerning="0"><b>0</b></font></p>

Press "M"=MAP

To adjust quality press "Q".

Sound On

Sound Off

Control

Score

<p align="right"><font face="_sans" size="20" color="#ffffff" letterSpacing="5.000000" kerning="0"><b>0</b></font></p>

Energy

LEVEL UP

WEAPON UPGRADE

D

GAMES.CO.UK

developed by

Skip

View high scores

Start Game

controls:
AIM = Mouse
WASD = Movement
HOLD Mouse button (left) = Shoot
DOUBLE Click Mouse button (left) = Drop mine

Instructions:
Collect to restore weapon energy =
and gain exp
Find / destroy to unlock final exit =
Transport to next / previous area =

Instructions

more from

Continue?

no

yes

Game Over

Main Menu

ActionScript [AS1/AS2]

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();

Library Items

Symbol 1 GraphicUsed by:277 363 366 368 373 460 461  Timeline
Symbol 2 FontUsed by:3 6 129
Symbol 3 EditableTextUses:2Used by:Timeline
Symbol 4 FontUsed by:5
Symbol 5 TextUses:4Used by:Timeline
Symbol 6 TextUses:2Used by:Timeline
Symbol 7 GraphicUsed by:8
Symbol 8 MovieClipUses:7Used by:Timeline
Symbol 9 GraphicUsed by:Timeline
Symbol 463 MovieClip [__Packages.mochi.as2.MochiSync]
Symbol 464 MovieClip [__Packages.mochi.as2.MochiServices]
Symbol 465 MovieClip [__Packages.mochi.as2.MochiEventDispatcher]
Symbol 466 MovieClip [__Packages.mochi.as2.MochiEvents]
Symbol 467 MovieClip [__Packages.mochi.as2.MochiCoins]
Symbol 468 MovieClip [__Packages.mochi.as2.MochiScores]
Symbol 469 MovieClip [__Packages.mochi.as2.MochiDigits]
Symbol 10 BitmapUsed by:11
Symbol 11 GraphicUses:10Used by:12
Symbol 12 MovieClip [bga]Uses:11Used by:Timeline
Symbol 13 BitmapUsed by:14
Symbol 14 GraphicUses:13Used by:15
Symbol 15 MovieClip [bg2]Uses:14Used by:Timeline
Symbol 16 BitmapUsed by:17
Symbol 17 GraphicUses:16Used by:18 288
Symbol 18 MovieClip [background]Uses:17Used by:420  Timeline
Symbol 19 BitmapUsed by:20
Symbol 20 GraphicUses:19Used by:25
Symbol 21 BitmapUsed by:22
Symbol 22 GraphicUses:21Used by:25
Symbol 23 BitmapUsed by:24
Symbol 24 GraphicUses:23Used by:25
Symbol 25 MovieClipUses:20 22 24Used by:26 251
Symbol 26 MovieClip [enemy]Uses:25Used by:Timeline
Symbol 27 GraphicUsed by:28
Symbol 28 MovieClipUses:27Used by:34
Symbol 29 GraphicUsed by:30
Symbol 30 MovieClipUses:29Used by:34
Symbol 31 BitmapUsed by:32
Symbol 32 GraphicUses:31Used by:33
Symbol 33 MovieClipUses:32Used by:34
Symbol 34 MovieClip [bomb]Uses:28 30 33Used by:Timeline
Symbol 35 BitmapUsed by:36
Symbol 36 GraphicUses:35Used by:51
Symbol 37 BitmapUsed by:38
Symbol 38 GraphicUses:37Used by:51
Symbol 39 BitmapUsed by:40
Symbol 40 GraphicUses:39Used by:51
Symbol 41 BitmapUsed by:42
Symbol 42 GraphicUses:41Used by:51
Symbol 43 BitmapUsed by:44
Symbol 44 GraphicUses:43Used by:51
Symbol 45 BitmapUsed by:46
Symbol 46 GraphicUses:45Used by:51
Symbol 47 BitmapUsed by:48
Symbol 48 GraphicUses:47Used by:51
Symbol 49 BitmapUsed by:50
Symbol 50 GraphicUses:49Used by:51
Symbol 51 MovieClipUses:36 38 40 42 44 46 48 50Used by:58 273
Symbol 52 BitmapUsed by:53
Symbol 53 GraphicUses:52Used by:54
Symbol 54 MovieClipUses:53Used by:58 419
Symbol 55 BitmapUsed by:56
Symbol 56 GraphicUses:55Used by:57
Symbol 57 MovieClipUses:56Used by:58
Symbol 58 MovieClip [player]Uses:51 54 57Used by:438  Timeline
Symbol 59 BitmapUsed by:60
Symbol 60 GraphicUses:59Used by:109
Symbol 61 BitmapUsed by:62
Symbol 62 GraphicUses:61Used by:109
Symbol 63 BitmapUsed by:64
Symbol 64 GraphicUses:63Used by:109
Symbol 65 BitmapUsed by:66
Symbol 66 GraphicUses:65Used by:109
Symbol 67 BitmapUsed by:68
Symbol 68 GraphicUses:67Used by:109
Symbol 69 BitmapUsed by:70
Symbol 70 GraphicUses:69Used by:109
Symbol 71 BitmapUsed by:72
Symbol 72 GraphicUses:71Used by:109
Symbol 73 BitmapUsed by:74
Symbol 74 GraphicUses:73Used by:109
Symbol 75 BitmapUsed by:76
Symbol 76 GraphicUses:75Used by:109
Symbol 77 BitmapUsed by:78
Symbol 78 GraphicUses:77Used by:109
Symbol 79 BitmapUsed by:80
Symbol 80 GraphicUses:79Used by:109
Symbol 81 BitmapUsed by:82
Symbol 82 GraphicUses:81Used by:109
Symbol 83 BitmapUsed by:84
Symbol 84 GraphicUses:83Used by:109
Symbol 85 BitmapUsed by:86
Symbol 86 GraphicUses:85Used by:109
Symbol 87 BitmapUsed by:88
Symbol 88 GraphicUses:87Used by:109
Symbol 89 BitmapUsed by:90
Symbol 90 GraphicUses:89Used by:109
Symbol 91 BitmapUsed by:92
Symbol 92 GraphicUses:91Used by:109
Symbol 93 BitmapUsed by:94
Symbol 94 GraphicUses:93Used by:109
Symbol 95 BitmapUsed by:96
Symbol 96 GraphicUses:95Used by:109
Symbol 97 BitmapUsed by:98
Symbol 98 GraphicUses:97Used by:109
Symbol 99 BitmapUsed by:100
Symbol 100 GraphicUses:99Used by:109
Symbol 101 BitmapUsed by:102
Symbol 102 GraphicUses:101Used by:109
Symbol 103 BitmapUsed by:104
Symbol 104 GraphicUses:103Used by:109
Symbol 105 BitmapUsed by:106
Symbol 106 GraphicUses:105Used by:109
Symbol 107 BitmapUsed by:108
Symbol 108 GraphicUses:107Used by:109
Symbol 109 MovieClipUses:60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108Used by:110 278
Symbol 110 MovieClip [explosion]Uses:109Used by:Timeline
Symbol 111 GraphicUsed by:113 160
Symbol 112 GraphicUsed by:113
Symbol 113 MovieClip [healthBar]Uses:111 112Used by:Timeline
Symbol 114 GraphicUsed by:122 162
Symbol 115 GraphicUsed by:116
Symbol 116 MovieClipUses:115Used by:122 162
Symbol 117 FontUsed by:118 119 120 121 128 140 144 156 157 161 367 374 394 459
Symbol 118 EditableTextUses:117Used by:122
Symbol 119 EditableTextUses:117Used by:122
Symbol 120 EditableTextUses:117Used by:122
Symbol 121 EditableTextUses:117Used by:122
Symbol 122 MovieClip [barBoarder]Uses:114 116 118 119 120 121Used by:Timeline
Symbol 123 GraphicUsed by:124
Symbol 124 MovieClipUses:123Used by:125 183 184
Symbol 125 MovieClip [enemy_shot]Uses:124Used by:Timeline
Symbol 126 GraphicUsed by:127 186
Symbol 127 MovieClip [phit]Uses:126Used by:Timeline
Symbol 128 EditableTextUses:117Used by:131
Symbol 129 TextUses:2Used by:130
Symbol 130 MovieClipUses:129Used by:131
Symbol 131 MovieClip [qualityControl]Uses:128 130Used by:Timeline
Symbol 132 GraphicUsed by:133
Symbol 133 MovieClipUses:132Used by:146
Symbol 134 GraphicUsed by:135 301 404
Symbol 135 MovieClipUses:134Used by:136 137
Symbol 136 MovieClipUses:135Used by:138
Symbol 137 MovieClipUses:135Used by:138
Symbol 138 MovieClipUses:136 137Used by:139 143
Symbol 139 MovieClipUses:138Used by:146
Symbol 140 TextUses:117Used by:146
Symbol 141 GraphicUsed by:142 145
Symbol 142 ButtonUses:141Used by:146
Symbol 143 MovieClipUses:138Used by:146
Symbol 144 TextUses:117Used by:146
Symbol 145 ButtonUses:141Used by:146
Symbol 146 MovieClipUses:133 139 140 142 143 144 145Used by:151
Symbol 147 GraphicUsed by:150
Symbol 148 FontUsed by:149
Symbol 149 TextUses:148Used by:150
Symbol 150 MovieClipUses:147 149Used by:151
Symbol 151 MovieClip [sound_contr]Uses:146 150Used by:Timeline
Symbol 152 GraphicUsed by:153
Symbol 153 MovieClip [crosshair]Uses:152Used by:Timeline
Symbol 154 GraphicUsed by:155
Symbol 155 MovieClip [plusTen]Uses:154Used by:Timeline
Symbol 156 EditableTextUses:117Used by:158
Symbol 157 EditableTextUses:117Used by:158
Symbol 158 MovieClip [points]Uses:156 157Used by:Timeline
Symbol 159 GraphicUsed by:160
Symbol 160 MovieClip [swordBar]Uses:111 159Used by:Timeline
Symbol 161 EditableTextUses:117Used by:162
Symbol 162 MovieClip [barBoarder3]Uses:114 116 161Used by:Timeline
Symbol 163 BitmapUsed by:164
Symbol 164 GraphicUses:163Used by:165
Symbol 165 MovieClipUses:164Used by:166
Symbol 166 MovieClip [new_ik_enemy]Uses:165Used by:167 169
Symbol 167 MovieClipUses:166Used by:168 388
Symbol 168 MovieClip [bell]Uses:167Used by:Timeline
Symbol 169 MovieClipUses:166Used by:170
Symbol 170 MovieClip [cunt]Uses:169Used by:Timeline
Symbol 171 BitmapUsed by:172
Symbol 172 GraphicUses:171Used by:173
Symbol 173 MovieClip [fade]Uses:172Used by:Timeline
Symbol 174 BitmapUsed by:175
Symbol 175 GraphicUses:174Used by:176 269
Symbol 176 MovieClipUses:175Used by:182
Symbol 177 BitmapUsed by:178
Symbol 178 GraphicUses:177Used by:179
Symbol 179 MovieClipUses:178Used by:180
Symbol 180 MovieClipUses:179Used by:181 270 391
Symbol 181 MovieClipUses:180Used by:182
Symbol 182 MovieClip [teleporter]Uses:176 181Used by:438  Timeline
Symbol 183 MovieClip [spark]Uses:124Used by:Timeline
Symbol 184 MovieClip [spark2]Uses:124Used by:Timeline
Symbol 185 MovieClip [effectHolder_mc]Used by:Timeline
Symbol 186 MovieClipUses:126Used by:187
Symbol 187 MovieClip [spac]Uses:186Used by:Timeline
Symbol 188 BitmapUsed by:189
Symbol 189 GraphicUses:188Used by:190
Symbol 190 MovieClipUses:189Used by:191
Symbol 191 MovieClip [object]Uses:190Used by:Timeline
Symbol 192 GraphicUsed by:193
Symbol 193 MovieClipUses:192Used by:200
Symbol 194 BitmapUsed by:195
Symbol 195 GraphicUses:194Used by:196
Symbol 196 MovieClipUses:195Used by:197
Symbol 197 MovieClipUses:196Used by:200
Symbol 198 GraphicUsed by:199
Symbol 199 MovieClipUses:198Used by:200
Symbol 200 MovieClip [powerUp]Uses:193 197 199Used by:Timeline
Symbol 201 BitmapUsed by:202
Symbol 202 GraphicUses:201Used by:223 419 437
Symbol 203 BitmapUsed by:204
Symbol 204 GraphicUses:203Used by:223 419 437
Symbol 205 BitmapUsed by:206
Symbol 206 GraphicUses:205Used by:223 419 437
Symbol 207 BitmapUsed by:208
Symbol 208 GraphicUses:207Used by:223 419 437
Symbol 209 BitmapUsed by:210
Symbol 210 GraphicUses:209Used by:223 419 437
Symbol 211 BitmapUsed by:212
Symbol 212 GraphicUses:211Used by:223 419 437
Symbol 213 BitmapUsed by:214
Symbol 214 GraphicUses:213Used by:223 419 437
Symbol 215 BitmapUsed by:216
Symbol 216 GraphicUses:215Used by:223 419 437
Symbol 217 BitmapUsed by:218
Symbol 218 GraphicUses:217Used by:223 419 437
Symbol 219 BitmapUsed by:220
Symbol 220 GraphicUses:219Used by:223 419 437
Symbol 221 BitmapUsed by:222
Symbol 222 GraphicUses:221Used by:223 419 437
Symbol 223 MovieClipUses:202 204 206 208 210 212 214 216 218 220 222Used by:224
Symbol 224 MovieClip [cfx]Uses:223Used by:Timeline
Symbol 225 BitmapUsed by:226
Symbol 226 GraphicUses:225Used by:231
Symbol 227 BitmapUsed by:228
Symbol 228 GraphicUses:227Used by:231
Symbol 229 BitmapUsed by:230
Symbol 230 GraphicUses:229Used by:231
Symbol 231 MovieClipUses:226 228 230Used by:232
Symbol 232 MovieClip [enemy2]Uses:231Used by:Timeline
Symbol 233 BitmapUsed by:234
Symbol 234 GraphicUses:233Used by:241
Symbol 235 BitmapUsed by:236
Symbol 236 GraphicUses:235Used by:241
Symbol 237 BitmapUsed by:238
Symbol 238 GraphicUses:237Used by:241
Symbol 239 BitmapUsed by:240
Symbol 240 GraphicUses:239Used by:241
Symbol 241 MovieClipUses:234 236 238 240Used by:242 295
Symbol 242 MovieClip [rio]Uses:241Used by:Timeline
Symbol 243 BitmapUsed by:244
Symbol 244 GraphicUses:243Used by:249
Symbol 245 BitmapUsed by:246
Symbol 246 GraphicUses:245Used by:249
Symbol 247 BitmapUsed by:248
Symbol 248 GraphicUses:247Used by:249
Symbol 249 MovieClipUses:244 246 248Used by:250 251
Symbol 250 MovieClip [senemy]Uses:249Used by:Timeline
Symbol 251 MovieClip [monster]Uses:25 249Used by:Timeline
Symbol 252 GraphicUsed by:253
Symbol 253 MovieClip [plusMore]Uses:252Used by:Timeline
Symbol 254 BitmapUsed by:255
Symbol 255 GraphicUses:254Used by:256
Symbol 256 MovieClipUses:255Used by:257
Symbol 257 MovieClip [key]Uses:256Used by:391  Timeline
Symbol 258 BitmapUsed by:259
Symbol 259 GraphicUses:258Used by:260
Symbol 260 MovieClip [abg2]Uses:259Used by:Timeline
Symbol 261 BitmapUsed by:262
Symbol 262 GraphicUses:261Used by:263
Symbol 263 MovieClip [abga]Uses:262Used by:Timeline
Symbol 264 GraphicUsed by:265 416
Symbol 265 MovieClip [redflash]Uses:264Used by:Timeline
Symbol 266 GraphicUsed by:268
Symbol 267 GraphicUsed by:268
Symbol 268 MovieClipUses:266 267Used by:270
Symbol 269 MovieClipUses:175Used by:270
Symbol 270 MovieClip [Fteleporter]Uses:268 269 180Used by:Timeline
Symbol 271 BitmapUsed by:272
Symbol 272 GraphicUses:271Used by:273
Symbol 273 MovieClip [finalBoss]Uses:51 272Used by:Timeline
Symbol 274 BitmapUsed by:275
Symbol 275 GraphicUses:274Used by:276
Symbol 276 MovieClip [bg3]Uses:275Used by:438  Timeline
Symbol 277 MovieClip [fadeToBlack]Uses:1Used by:Timeline
Symbol 278 MovieClip [explosion5]Uses:109Used by:Timeline
Symbol 279 BitmapUsed by:280 283
Symbol 280 GraphicUses:279Used by:281
Symbol 281 MovieClipUses:280Used by:287
Symbol 282 GraphicUsed by:286
Symbol 283 GraphicUses:279Used by:286
Symbol 284 BitmapUsed by:285
Symbol 285 GraphicUses:284Used by:286
Symbol 286 MovieClipUses:282 283 285Used by:287
Symbol 287 MovieClipUses:281 286Used by:288 420
Symbol 288 MovieClip [fortards]Uses:17 287Used by:Timeline
Symbol 289 GraphicUsed by:290 456
Symbol 290 MovieClipUses:289Used by:291
Symbol 291 MovieClip [upg1]Uses:290Used by:Timeline
Symbol 292 GraphicUsed by:293
Symbol 293 MovieClipUses:292Used by:294
Symbol 294 MovieClip [yellows]Uses:293Used by:Timeline
Symbol 295 MovieClip [greens]Uses:241Used by:Timeline
Symbol 296 FontUsed by:297 298
Symbol 297 TextUses:296Used by:299
Symbol 298 TextUses:296Used by:299
Symbol 299 MovieClipUses:297 298Used by:300
Symbol 300 MovieClip [lvluptxt]Uses:299Used by:Timeline
Symbol 301 MovieClipUses:134Used by:302
Symbol 302 MovieClipUses:301Used by:309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
Symbol 303 GraphicUsed by:304
Symbol 304 MovieClipUses:303Used by:305
Symbol 305 MovieClipUses:304Used by:309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
Symbol 306 GraphicUsed by:307
Symbol 307 MovieClipUses:306Used by:308
Symbol 308 MovieClipUses:307Used by:309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
Symbol 309 MovieClipUses:302 305 308Used by:338
Symbol 310 MovieClipUses:302 305 308Used by:338
Symbol 311 MovieClipUses:302 305 308Used by:338
Symbol 312 MovieClipUses:302 305 308Used by:338
Symbol 313 MovieClipUses:302 305 308Used by:338
Symbol 314 MovieClipUses:302 305 308Used by:338
Symbol 315 MovieClipUses:302 305 308Used by:338
Symbol 316 MovieClipUses:302 305 308Used by:338
Symbol 317 MovieClipUses:302 305 308Used by:338
Symbol 318 MovieClipUses:302 305 308Used by:338
Symbol 319 MovieClipUses:302 305 308Used by:338
Symbol 320 MovieClipUses:302 305 308Used by:338
Symbol 321 MovieClipUses:302 305 308Used by:338
Symbol 322 MovieClipUses:302 305 308Used by:338
Symbol 323 MovieClipUses:302 305 308Used by:338
Symbol 324 MovieClipUses:302 305 308Used by:338
Symbol 325 MovieClipUses:302 305 308Used by:338
Symbol 326 MovieClipUses:302 305 308Used by:338
Symbol 327 MovieClipUses:302 305 308Used by:338
Symbol 328 MovieClipUses:302 305 308Used by:338
Symbol 329 MovieClipUses:302 305 308Used by:338
Symbol 330 MovieClipUses:302 305 308Used by:338
Symbol 331 MovieClipUses:302 305 308Used by:338
Symbol 332 MovieClipUses:302 305 308Used by:338
Symbol 333 MovieClipUses:302 305 308Used by:338
Symbol 334 MovieClipUses:302 305 308Used by:338
Symbol 335 MovieClipUses:302 305 308Used by:338
Symbol 336 MovieClipUses:302 305 308Used by:338
Symbol 337 MovieClipUses:302 305 308Used by:338
Symbol 338 MovieClip [map]Uses:302 305 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337Used by:Timeline
Symbol 339 Sound [ak47]Used by:Timeline
Symbol 340 Sound [shunkanido]Used by:Timeline
Symbol 341 Sound [blip]Used by:Timeline
Symbol 342 Sound [hit.mp3]Used by:Timeline
Symbol 343 ShapeTweeningUsed by:345
Symbol 344 GraphicUsed by:345
Symbol 345 MovieClipUses:343 344Used by:362
Symbol 346 GraphicUsed by:347
Symbol 347 MovieClipUses:346Used by:362
Symbol 348 ShapeTweeningUsed by:350
Symbol 349 GraphicUsed by:350
Symbol 350 MovieClipUses:348 349Used by:362
Symbol 351 ShapeTweeningUsed by:353
Symbol 352 GraphicUsed by:353
Symbol 353 MovieClipUses:351 352Used by:362
Symbol 354 FontUsed by:355 357 358
Symbol 355 TextUses:354Used by:356
Symbol 356 MovieClipUses:355Used by:362
Symbol 357 TextUses:354Used by:359
Symbol 358 TextUses:354Used by:359
Symbol 359 MovieClipUses:357 358Used by:362
Symbol 360 MovieClipUsed by:361
Symbol 361 MovieClipUses:360Used by:362
Symbol 362 MovieClipUses:345 347 350 353 356 359 361Used by:363
Symbol 363 MovieClipUses:1 362 SS1Used by:Timeline
Symbol 364 VideoUsed by:365
Symbol 365 MovieClipUses:364 SS2Used by:Timeline
Symbol 366 MovieClipUses:1Used by:368
Symbol 367 EditableTextUses:117Used by:368
Symbol 368 ButtonUses:366 367 1Used by:Timeline
Symbol 369 BitmapUsed by:370
Symbol 370 GraphicUses:369Used by:Timeline
Symbol 371 GraphicUsed by:372
Symbol 372 MovieClipUses:371Used by:Timeline
Symbol 373 MovieClipUses:1Used by:375
Symbol 374 TextUses:117Used by:375
Symbol 375 MovieClipUses:373 374Used by:Timeline
Symbol 376 GraphicUsed by:377
Symbol 377 MovieClipUses:376Used by:381
Symbol 378 FontUsed by:379
Symbol 379 TextUses:378Used by:381
Symbol 380 GraphicUsed by:381
Symbol 381 MovieClipUses:377 379 380Used by:Timeline
Symbol 382 GraphicUsed by:383
Symbol 383 MovieClipUses:382Used by:391
Symbol 384 FontUsed by:386 387
Symbol 385 FontUsed by:386 387 401 405 408 457
Symbol 386 TextUses:384 385Used by:391
Symbol 387 TextUses:384 385Used by:391
Symbol 388 MovieClipUses:167Used by:391
Symbol 389 GraphicUsed by:390
Symbol 390 MovieClipUses:389Used by:391
Symbol 391 MovieClipUses:383 386 387 388 257 180 390Used by:Timeline
Symbol 392 GraphicUsed by:393
Symbol 393 MovieClipUses:392Used by:395
Symbol 394 TextUses:117Used by:395
Symbol 395 MovieClipUses:393 394Used by:Timeline
Symbol 396 GraphicUsed by:397
Symbol 397 MovieClipUses:396Used by:400
Symbol 398 FontUsed by:399
Symbol 399 TextUses:398Used by:400
Symbol 400 MovieClipUses:397 399Used by:Timeline
Symbol 401 TextUses:385Used by:402
Symbol 402 MovieClipUses:401Used by:403
Symbol 403 MovieClipUses:402Used by:Timeline
Symbol 404 MovieClipUses:134Used by:407 410
Symbol 405 TextUses:385Used by:406
Symbol 406 MovieClipUses:405Used by:407
Symbol 407 MovieClipUses:404 406Used by:Timeline
Symbol 408 TextUses:385Used by:409
Symbol 409 MovieClipUses:408Used by:410
Symbol 410 MovieClipUses:404 409Used by:Timeline
Symbol 411 GraphicUsed by:412
Symbol 412 MovieClipUses:411Used by:Timeline
Symbol 413 BitmapUsed by:414
Symbol 414 GraphicUses:413Used by:415
Symbol 415 MovieClipUses:414Used by:419 437
Symbol 416 MovieClipUses:264Used by:419
Symbol 417 SoundUsed by:419
Symbol 418 SoundUsed by:419 437
Symbol 419 MovieClipUses:415 416 417 54 202 418 204 206 208 210 212 214 216 218 220 222Used by:420
Symbol 420 MovieClipUses:18 419 287Used by:Timeline
Symbol 421 SoundUsed by:Timeline
Symbol 422 BitmapUsed by:423
Symbol 423 GraphicUses:422Used by:424
Symbol 424 MovieClipUses:423Used by:437
Symbol 425 BitmapUsed by:426
Symbol 426 GraphicUses:425Used by:427
Symbol 427 MovieClipUses:426Used by:437
Symbol 428 BitmapUsed by:429
Symbol 429 GraphicUses:428Used by:430
Symbol 430 MovieClipUses:429Used by:437
Symbol 431 BitmapUsed by:432
Symbol 432 GraphicUses:431Used by:433
Symbol 433 MovieClipUses:432Used by:437
Symbol 434 BitmapUsed by:435
Symbol 435 GraphicUses:434Used by:436
Symbol 436 MovieClipUses:435Used by:437
Symbol 437 MovieClipUses:424 427 430 202 418 204 206 208 210 212 214 415 433 216 218 220 222 436Used by:438
Symbol 438 MovieClipUses:276 437 182 58Used by:452
Symbol 439 SoundUsed by:452
Symbol 440 BitmapUsed by:441
Symbol 441 GraphicUses:440Used by:442
Symbol 442 MovieClipUses:441Used by:452
Symbol 443 GraphicUsed by:444
Symbol 444 MovieClipUses:443Used by:445
Symbol 445 MovieClipUses:444Used by:452
Symbol 446 GraphicUsed by:447
Symbol 447 MovieClipUses:446Used by:448
Symbol 448 MovieClipUses:447Used by:452
Symbol 449 BitmapUsed by:450
Symbol 450 GraphicUses:449Used by:451
Symbol 451 MovieClipUses:450Used by:452
Symbol 452 MovieClipUses:438 439 442 445 448 451Used by:Timeline
Symbol 453 SoundUsed by:Timeline
Symbol 454 BitmapUsed by:455
Symbol 455 GraphicUses:454Used by:456
Symbol 456 MovieClipUses:289 455Used by:Timeline
Symbol 457 TextUses:385Used by:458
Symbol 458 MovieClipUses:457Used by:Timeline
Symbol 459 EditableTextUses:117Used by:460
Symbol 460 ButtonUses:1 459Used by:Timeline
Symbol 461 MovieClipUses:1Used by:462
Symbol 462 MovieClipUses:461Used by:Timeline
Streaming Sound 1Used by:Symbol 363 MovieClip
Streaming Sound 2Used by:Symbol 365 MovieClip

Instance Names

"loadBar"Frame 1Symbol 8 MovieClip
"logo"Frame 6Symbol 363 MovieClip
"skipbtn"Frame 8Symbol 381 MovieClip
"instructions"Frame 8Symbol 391 MovieClip
"inti"Frame 8Symbol 395 MovieClip
"xdq"Frame 8Symbol 400 MovieClip
"cont"Frame 10Symbol 403 MovieClip
"no"Frame 10Symbol 407 MovieClip
"yes"Frame 10Symbol 410 MovieClip
"xdq"Frame 10Symbol 400 MovieClip
"xdq"Frame 44Symbol 400 MovieClip
"exps"Symbol 122 MovieClip [barBoarder] Frame 1Symbol 120 EditableText
"qual"Symbol 131 MovieClip [qualityControl] Frame 1Symbol 128 EditableText
"qanda"Symbol 131 MovieClip [qualityControl] Frame 1Symbol 130 MovieClip
"pts"Symbol 158 MovieClip [points] Frame 1Symbol 157 EditableText

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS1/AS2.
ExportAssets (56)Timeline Frame 1Symbol 463 as "__Packages.mochi.as2.MochiSync"
ExportAssets (56)Timeline Frame 1Symbol 464 as "__Packages.mochi.as2.MochiServices"
ExportAssets (56)Timeline Frame 1Symbol 465 as "__Packages.mochi.as2.MochiEventDispatcher"
ExportAssets (56)Timeline Frame 1Symbol 466 as "__Packages.mochi.as2.MochiEvents"
ExportAssets (56)Timeline Frame 1Symbol 467 as "__Packages.mochi.as2.MochiCoins"
ExportAssets (56)Timeline Frame 1Symbol 468 as "__Packages.mochi.as2.MochiScores"
ExportAssets (56)Timeline Frame 1Symbol 469 as "__Packages.mochi.as2.MochiDigits"
ExportAssets (56)Timeline Frame 4Symbol 12 as "bga"
ExportAssets (56)Timeline Frame 4Symbol 15 as "bg2"
ExportAssets (56)Timeline Frame 4Symbol 18 as "background"
ExportAssets (56)Timeline Frame 4Symbol 26 as "enemy"
ExportAssets (56)Timeline Frame 4Symbol 34 as "bomb"
ExportAssets (56)Timeline Frame 4Symbol 58 as "player"
ExportAssets (56)Timeline Frame 4Symbol 110 as "explosion"
ExportAssets (56)Timeline Frame 4Symbol 113 as "healthBar"
ExportAssets (56)Timeline Frame 4Symbol 122 as "barBoarder"
ExportAssets (56)Timeline Frame 4Symbol 125 as "enemy_shot"
ExportAssets (56)Timeline Frame 4Symbol 127 as "phit"
ExportAssets (56)Timeline Frame 4Symbol 131 as "qualityControl"
ExportAssets (56)Timeline Frame 4Symbol 151 as "sound_contr"
ExportAssets (56)Timeline Frame 4Symbol 153 as "crosshair"
ExportAssets (56)Timeline Frame 4Symbol 155 as "plusTen"
ExportAssets (56)Timeline Frame 4Symbol 158 as "points"
ExportAssets (56)Timeline Frame 4Symbol 160 as "swordBar"
ExportAssets (56)Timeline Frame 4Symbol 162 as "barBoarder3"
ExportAssets (56)Timeline Frame 4Symbol 166 as "new_ik_enemy"
ExportAssets (56)Timeline Frame 4Symbol 168 as "bell"
ExportAssets (56)Timeline Frame 4Symbol 170 as "cunt"
ExportAssets (56)Timeline Frame 4Symbol 173 as "fade"
ExportAssets (56)Timeline Frame 4Symbol 182 as "teleporter"
ExportAssets (56)Timeline Frame 4Symbol 183 as "spark"
ExportAssets (56)Timeline Frame 4Symbol 184 as "spark2"
ExportAssets (56)Timeline Frame 4Symbol 185 as "effectHolder_mc"
ExportAssets (56)Timeline Frame 4Symbol 187 as "spac"
ExportAssets (56)Timeline Frame 4Symbol 191 as "object"
ExportAssets (56)Timeline Frame 4Symbol 200 as "powerUp"
ExportAssets (56)Timeline Frame 4Symbol 224 as "cfx"
ExportAssets (56)Timeline Frame 4Symbol 232 as "enemy2"
ExportAssets (56)Timeline Frame 4Symbol 242 as "rio"
ExportAssets (56)Timeline Frame 4Symbol 250 as "senemy"
ExportAssets (56)Timeline Frame 4Symbol 251 as "monster"
ExportAssets (56)Timeline Frame 4Symbol 253 as "plusMore"
ExportAssets (56)Timeline Frame 4Symbol 257 as "key"
ExportAssets (56)Timeline Frame 4Symbol 260 as "abg2"
ExportAssets (56)Timeline Frame 4Symbol 263 as "abga"
ExportAssets (56)Timeline Frame 4Symbol 265 as "redflash"
ExportAssets (56)Timeline Frame 4Symbol 270 as "Fteleporter"
ExportAssets (56)Timeline Frame 4Symbol 273 as "finalBoss"
ExportAssets (56)Timeline Frame 4Symbol 276 as "bg3"
ExportAssets (56)Timeline Frame 4Symbol 277 as "fadeToBlack"
ExportAssets (56)Timeline Frame 4Symbol 278 as "explosion5"
ExportAssets (56)Timeline Frame 4Symbol 288 as "fortards"
ExportAssets (56)Timeline Frame 4Symbol 291 as "upg1"
ExportAssets (56)Timeline Frame 4Symbol 294 as "yellows"
ExportAssets (56)Timeline Frame 4Symbol 295 as "greens"
ExportAssets (56)Timeline Frame 4Symbol 300 as "lvluptxt"
ExportAssets (56)Timeline Frame 4Symbol 338 as "map"
ExportAssets (56)Timeline Frame 4Symbol 339 as "ak47"
ExportAssets (56)Timeline Frame 4Symbol 340 as "shunkanido"
ExportAssets (56)Timeline Frame 4Symbol 341 as "blip"
ExportAssets (56)Timeline Frame 4Symbol 342 as "hit.mp3"

Labels

"title"Frame 8
"reset"Frame 10
"stargame"Frame 11
"area1"Frame 12
"area2"Frame 13
"area3"Frame 14
"area4"Frame 15
"side1"Frame 16
"area5"Frame 17
"side2"Frame 18
"area6"Frame 19
"side3"Frame 20
"area7"Frame 21
"area8"Frame 22
"side4"Frame 23
"side5"Frame 24
"side6"Frame 25
"area9"Frame 26
"area10"Frame 27
"area11"Frame 28
"area12"Frame 29
"side7"Frame 30
"area13"Frame 31
"side8"Frame 32
"area14"Frame 33
"side9"Frame 34
"area15"Frame 35
"area16"Frame 36
"side10"Frame 37
"side11"Frame 38
"side12"Frame 39
"area17"Frame 40
"fscene"Frame 41
"bossEncounter"Frame 42
"completedG"Frame 43
"normal"Symbol 58 MovieClip [player] Frame 1
"hit"Symbol 58 MovieClip [player] Frame 2
"idle"Symbol 58 MovieClip [player] Frame 3
"normal"Symbol 113 MovieClip [healthBar] Frame 1
"max"Symbol 113 MovieClip [healthBar] Frame 2
"normal"Symbol 160 MovieClip [swordBar] Frame 1
"max"Symbol 160 MovieClip [swordBar] Frame 2
"closed"Symbol 182 MovieClip [teleporter] Frame 1
"open"Symbol 182 MovieClip [teleporter] Frame 2
"closed"Symbol 270 MovieClip [Fteleporter] Frame 1
"open"Symbol 270 MovieClip [Fteleporter] Frame 2
"area1"Symbol 338 MovieClip [map] Frame 1
"area2"Symbol 338 MovieClip [map] Frame 2
"area3"Symbol 338 MovieClip [map] Frame 3
"area4"Symbol 338 MovieClip [map] Frame 4
"side1"Symbol 338 MovieClip [map] Frame 5
"area5"Symbol 338 MovieClip [map] Frame 6
"side2"Symbol 338 MovieClip [map] Frame 7
"area6"Symbol 338 MovieClip [map] Frame 8
"side3"Symbol 338 MovieClip [map] Frame 9
"area7"Symbol 338 MovieClip [map] Frame 10
"area8"Symbol 338 MovieClip [map] Frame 11
"side4"Symbol 338 MovieClip [map] Frame 12
"side5"Symbol 338 MovieClip [map] Frame 13
"side6"Symbol 338 MovieClip [map] Frame 14
"area9"Symbol 338 MovieClip [map] Frame 15
"area10"Symbol 338 MovieClip [map] Frame 16
"area11"Symbol 338 MovieClip [map] Frame 17
"area12"Symbol 338 MovieClip [map] Frame 18
"side7"Symbol 338 MovieClip [map] Frame 19
"area13"Symbol 338 MovieClip [map] Frame 20
"side8"Symbol 338 MovieClip [map] Frame 21
"area14"Symbol 338 MovieClip [map] Frame 22
"side9"Symbol 338 MovieClip [map] Frame 23
"area15"Symbol 338 MovieClip [map] Frame 24
"area16"Symbol 338 MovieClip [map] Frame 25
"area17"Symbol 338 MovieClip [map] Frame 26
"side10"Symbol 338 MovieClip [map] Frame 27
"side11"Symbol 338 MovieClip [map] Frame 28
"area18"Symbol 338 MovieClip [map] Frame 29
"exit"Symbol 338 MovieClip [map] Frame 30

Dynamic Text Variables

loadTextSymbol 3 EditableText"Loading...."




http://swfchan.com/19/90404/info.shtml
Created: 28/3 -2019 10:59:33 Last modified: 28/3 -2019 10:59:33 Server time: 04/05 -2024 06:49:20