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

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

Medieval Rampage 3.swf

This is the info page for
Flash #211634

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


ActionScript [AS1/AS2]
Combined Code
movieClip 4 spike5 { } movieClip 20 { frame 16 { _parent.removeMovieClip(); } } movieClip 34 { frame 16 { _parent.removeMovieClip(); } } movieClip 49 { frame 16 { _parent.removeMovieClip(); } } movieClip 50 floorShot { } movieClip 131 Blood3 { frame 40 { _parent.removeMovieClip(); } } movieClip 212 Blood1 { frame 40 { _parent.removeMovieClip(); } } movieClip 293 Blood2 { frame 40 { _parent.removeMovieClip(); } } movieClip 374 Blood4 { frame 40 { _parent.removeMovieClip(); } } movieClip 375 blood { } movieClip 377 { } movieClip 378 spike3 { } movieClip 380 { } movieClip 382 { } movieClip 383 spike { } movieClip 385 spike4 { } frame 1 { function onEnterFrame() { if (!testing) { if (clickor) { clickor = false; __com_mochibot__('0c909317', this, 10301, true); } if (this._currentframe == 1) { bytes_loaded = Math.round(this.getBytesLoaded()); bytes_total = Math.round(this.getBytesTotal()); getPercent = bytes_loaded / bytes_total; loader._xscale = getPercent * 100; if (bytes_loaded == bytes_total && thePlay._x < 0) { if (domain == 'jaludo.com' || domain == 'media.jaludo.com') { } loader._x = 1000; outer._x = 1000; thePlay._x = Stage.width / 2; createStartHoverer(thePlay.s1); createStartHoverer(thePlay.s2); thePlay.s1.onRelease = function () { gotoAndStop(2); muted2 = false; }; thePlay.s2.onRelease = function () { gotoAndStop(2); muted2 = true; }; } } } else { bytes_loaded = Math.round(this.getBytesLoaded()); bytes_total = Math.round(this.getBytesTotal()); if (bytes_loaded == bytes_total && secretRelease._x == undefined) { if (domain == 'armorgames.com' || domain == 'www.armorgames.com') { gotoAndStop(2); } } } } stop(); testing = false; secretRelease.swapDepths(800333); if (testing) { } else { muted = false; clickor = false; createStartHoverer(secretRelease.a1); createStartHoverer(secretRelease.d1); secretRelease.a1.onRelease = function () { secretRelease.removeMovieClip(); }; secretRelease.d1.onRelease = function () { getURL('http://www.armorgames.com/', '_BLANK'); }; var myMenu = new ContextMenu(); myMenu.hideBuiltInItems(); var mainItem = new ContextMenuItem('Play More Games', goToThisURL); myMenu.customItems.push(mainItem); createContextMenu(myMenu); urlStart = _url.indexOf('://') + 3; urlEnd = _url.indexOf('/', urlStart); domain = _url.substring(urlStart, urlEnd); LastDot = domain.lastIndexOf('.') - 1; domEnd = domain.lastIndexOf('.', LastDot) + 1; domain = domain.substring(domEnd, domain.length); __com_mochibot__('22e6f813', this, 10301, true); if (domain == 'armorgames.com' || domain == 'www.armorgames.com') { } else {} } } movieClip 389 { frame 1 { stop(); } } // unknown tag 88 length 99 movieClip 393 { } movieClip 395 { } movieClip 401 { } instance of movieClip 401 { onClipEvent (release) { getURL('http://armorgames.com', '_BLANK'); } } // unknown tag 88 length 94 movieClip 408 starter { frame 1 { stop(); } } movieClip 413 starter2 { frame 1 { stop(); } } movieClip 414 { } frame 2 { var blah = new Sound(); blah.attachSound('ashot.mp3'); ag.onRelease = function () { getURL('http://armorgames.com/', '_BLANK'); }; if (muted2) { blah.setVolume(0); } } movieClip 419 { } movieClip 425 { } movieClip 428 { frame 1 { _root.stop(); gotoAndPlay(2); } frame 225 { _root.nextFrame(); } } frame 3 { function resetValues() { achievements = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); weaponSpeedLevels = new Array(0, 0, 0, 0, 0, 0); weaponPowerLevels = new Array(0, 0, 0, 0, 0, 0); weaponAmmoLevels = new Array(0, 0, 0, 0, 0, 0); skillLevels = new Array(0, 0, 0); ability = 0; yourName = ''; totAwards = 0; totalKills = 0; level = 1; money = 0; bowKills = new Array(0, 0, 0, 0, 0, 0); startingWep = 1; levelsUnlocked = 1; abilitiesOwned = new Array(false, false, false); weaponsOwned = new Array(false, false, false, false, false); } function loadGame() { if (sObject.data.totAwards != undefined) { totAwards = sObject.data.totAwards; } if (sObject.data.totalKills != undefined) { totalKills = sObject.data.totalKills; } if (sObject.data.level1 != undefined) { level = sObject.data.level1; } if (sObject.data.money != undefined) { money = sObject.data.money; } if (sObject.data.startingWep != undefined) { startingWep = sObject.data.startingWep; } if (sObject.data.ability != undefined) { ability = sObject.data.ability; } if (sObject.data.yourName != undefined) { yourName = sObject.data.yourName; } if (sObject.data.levelsUnlocked != undefined) { levelsUnlocked = sObject.data.levelsUnlocked; } i = 0; while (i <= achievements.length) { if (sObject.data.achievements[i] != undefined) { achievements[i] = sObject.data.achievements[i]; } ++i; } i = 0; while (i <= bowKills.length) { if (sObject.data.bowKills[i] != undefined) { bowKills[i] = sObject.data.bowKills[i]; } ++i; } i = 0; while (i <= weaponSpeedLevels.length) { if (sObject.data.weaponSpeedLevels[i] != undefined) { weaponSpeedLevels[i] = sObject.data.weaponSpeedLevels[i]; } ++i; } i = 0; while (i <= weaponPowerLevels.length) { if (sObject.data.weaponPowerLevels[i] != undefined) { weaponPowerLevels[i] = sObject.data.weaponPowerLevels[i]; } ++i; } i = 0; while (i <= weaponAmmoLevels.length) { if (sObject.data.weaponAmmoLevels[i] != undefined) { weaponAmmoLevels[i] = sObject.data.weaponAmmoLevels[i]; } ++i; } i = 0; while (i <= skillLevels.length) { if (sObject.data.skillLevels[i] != undefined) { skillLevels[i] = sObject.data.skillLevels[i]; } ++i; } i = 0; while (i <= abilitiesOwned.length) { if (sObject.data.abilitiesOwned[i] != undefined) { abilitiesOwned[i] = sObject.data.abilitiesOwned[i]; } ++i; } i = 0; while (i <= weaponsOwned.length) { if (sObject.data.weaponsOwned[i] != undefined) { weaponsOwned[i] = sObject.data.weaponsOwned[i]; } ++i; } } function saveGame() { sObject.data.totAwards = totAwards; sObject.data.totalKills = totalKills; sObject.data.level1 = level; sObject.data.money = money; sObject.data.startingWep = startingWep; sObject.data.ability = ability; sObject.data.yourName = yourName; sObject.data.levelsUnlocked = levelsUnlocked; sObject.data.achievements = achievements; sObject.data.bowKills = bowKills; sObject.data.weaponSpeedLevels = weaponSpeedLevels; sObject.data.weaponPowerLevels = weaponPowerLevels; sObject.data.weaponAmmoLevels = weaponAmmoLevels; sObject.data.skillLevels = skillLevels; sObject.data.weaponsOwned = weaponsOwned; sObject.data.abilitiesOwned = abilitiesOwned; sObject.flush(); } function createGenHoverC(button) { button.onRollOver = function () { if (button._currentframe != 3) { button.gotoAndStop(2); } }; button.onRollOut = function () { if (button._currentframe != 3) { button.gotoAndStop(1); } }; button.onReleaseOutside = function () { if (button._currentframe != 3) { button.gotoAndStop(1); } }; } function createGenHover(button) { button.onRollOver = function () { button.gotoAndStop(2); }; button.onRollOut = function () { button.gotoAndStop(1); }; button.onReleaseOutside = function () { button.gotoAndStop(1); }; } function onEnterFrame() { if (tran._currentframe == 60) { gotoAndStop(4); } if (toSet) { if (yourName != '') { c1.cIn.nameTxt.htmlText = yourName; } else { Selection.setFocus(_root.c1.cIn.nameTxt); } toSet = false; } if (!madeButton) { c1.cIn.nameTxt.onSetFocus = function () { toSet = true; }; madeButton = true; createGenHover(c1.cIn.contBtn); c1.cIn.contBtn.onRelease = function () { yourName = _root.c1.cIn.nameTxt.text; tran._x = Stage.width / 2; tran.play(); }; } } stop(); skirmishMode = false; descros = new Array('Start the Game', 'Kill 100 Enemies', 'Kill 300 Enemies', 'Kill 1000 Enemies', 'Kill 3000 Enemies', 'Play for 15 Minutes', 'Play for 120 Minutes', 'Pause The Game', 'Walk to the edge of the map', 'Shield Kill', 'Die', '5-0 in CTF', 'Never die in Survivor', 'First Blood', '2 Kill Streak', '4 Kill Streak', '6 Kill Streak', '8 Kill Streak', '10 Kill Streak', 'Double Kill', 'Triple Kill', 'Quadruple Kill', 'Quintuple Kill', '100 Kills w/ Regular Bow', '100 Kills w/ Composite Bow', '100 Kills w/ Cross Bow', '100 Kills w/ Compound Bow', '100 Kills w/ Blood Bow', '100 Kills w/ Dark Bow', 'Team Battle won on Insane', 'CTF won on Insane', 'FFF won on Insane', 'Survivor won on Insane', 'Territory won on Insane', 'Game Complete', 'Secret Achievement'); resetValues(); sObject = SharedObject.getLocal('saveFile'); loadGame(); g1.onRelease = function () { toRev.gotoAndPlay(2); }; gButtons = new Array(g1, g2, g3, g4, g5, g6, g7); g = 0; while (g < gButtons.length) { createGenHover(gButtons[g]); ++g; } g1.onRelease = function () { gotoAndStop(6); }; g2.onRelease = function () { gotoAndStop(7); }; g3.onRelease = function () { gotoAndStop(10); }; g4.onRelease = function () { gotoAndStop(8); }; g5.onRelease = function () { gotoAndStop(5); if (Key.isDown(40)) { gotoAndStop(10); } }; g6.onRelease = function () { getURL('http://armor.ag/MoreGames', '_blank'); }; g7.onRelease = function () { getURL('http://www.facebook.com/ArmorGames', '_blank'); }; madeButton = false; toSet = true; } instance of movieClip 401 { onClipEvent (release) { getURL('http://armorgames.com', '_BLANK'); } } movieClip 433 { } movieClip 435 { } movieClip 440 { frame 1 { stop(); } } movieClip 441 { frame 1 { stop(); } } movieClip 442 { } movieClip 445 { frame 1 { stop(); } } movieClip 453 { } movieClip 454 { frame 1 { stop(); } frame 20 { stop(); } } movieClip 455 { } movieClip 456 { frame 1 { stop(); } } movieClip 459 { frame 1 { stop(); } } frame 4 { function alphaHover(button) { button.onRollOver = function () { button._alpha = 75; }; button.onRollOut = function () { button._alpha = 100; }; } function pauseStuff() { if (playerPause) { ps = attachMovie('pauseScreen', 'pauseScreen' + higherDepth, higherDepth++); ps._x = Stage.width / 2; ps._y = Stage.height / 2; ps.ctu.onRelease = function () { ps.removeMovieClip(); playerPause = false; }; ps.qtm.onRelease = function () { ps.removeMovieClip(); removeGame(); gotoAndStop(3); }; } else { ps.removeMovieClip(); } } function createSecondHover(button, num) { button.onRollOver = function () { button.gotoAndStop(2); }; button.onRollOut = function () { button.gotoAndStop(1); }; button.onReleaseOutside = function () { button.gotoAndStop(1); }; button.onRelease = function () { helpScreen.gotoAndStop(num + 2); if (num == 3) { helpScreen.bowImg1.gotoAndStop(1); helpScreen.bowImg1.t1.gotoAndStop(2); helpScreen.bowImg2.gotoAndStop(2); helpScreen.bowImg2.t1.gotoAndStop(2); helpScreen.bowImg3.gotoAndStop(3); helpScreen.bowImg3.t1.gotoAndStop(2); helpScreen.bowImg4.gotoAndStop(4); helpScreen.bowImg4.t1.gotoAndStop(2); helpScreen.bowImg5.gotoAndStop(5); helpScreen.bowImg5.t1.gotoAndStop(2); helpScreen.bowImg6.gotoAndStop(6); helpScreen.bowImg6.t1.gotoAndStop(2); } }; } function bold(item) { return '<b>' + item + '</b>'; } function giveAward(awardnum) { if (award._currentframe == 1 && achievements[awardnum - 1] != 1) { award.aname.awardName.htmlText = bold(descros[awardnum - 1]); totAwards += 1; achievements[awardnum - 1] = 1; award.gotoAndPlay(2); } else { if (achievements[awardnum - 1] != 1) { awardqueue.push(awardnum); } } } function awardWait() { if (award._currentframe != 1) { award.play(); } if (award._currentframe == 1) { if (awardqueue.length != 0) { giveAward(awardqueue[0]); awardqueue.splice(0, 1); } } } function testKills() { h = 0; while (h < bowKills.length) { if (bowKills[h] >= 100) { giveAward(24 + h); } ++h; } if (timeToNextKill > 0) { killStreak += 1; if (killStreak == 2) { giveAward(20); } if (killStreak == 3) { giveAward(21); } if (killStreak == 4) { giveAward(22); } if (killStreak == 5) { giveAward(23); } } else { killStreak = 1; } killsWithoutDeath += 1; if (killsWithoutDeath == 2) { startInfo(21); giveAward(15); } if (killsWithoutDeath == 4) { startInfo(22); giveAward(16); } if (killsWithoutDeath == 6) { startInfo(23); giveAward(17); } if (killsWithoutDeath == 8) { startInfo(24); giveAward(18); } if (killsWithoutDeath == 10) { startInfo(25); giveAward(19); } timeToNextKill = 90; giveAward(14); if (totalKills >= 100) { giveAward(2); } if (totalKills >= 300) { giveAward(3); } if (totalKills >= 1000) { giveAward(4); } if (totalKills >= 3000) { giveAward(5); } } function startInfo(num) { tellInfo.c1.descTxt.htmlText = bold(infos[num - 1].toUpperCase()); tellInfo.gotoAndPlay(2); } function selectLevel(num) { bgItems.gotoAndStop(num); bg.bgIn.gotoAndStop(num); bgItems.fieldItems._alpha = 0; bgItems.fieldItems2._alpha = 0; bgItems.fieldItems3._alpha = 0; bgItems.fieldItems4._alpha = 0; bgItems.fieldItems5._alpha = 0; } function manageModes() { bgItems.z1.gotoAndStop(1); bgItems.z2.gotoAndStop(1); bgItems.f1._alpha = 100; bgItems.f2._alpha = 100; theArrow._alpha = 100; bgItems.t1.z1.gotoAndStop(1); bgItems.t2.z1.gotoAndStop(1); bgItems.t3.z1.gotoAndStop(1); hud.bh._alpha = 100; if (gameMode == 1 || gameMode == 6 && (teacherNum == 7 || teacherNum == 8)) { } else { bgItems.z1.gotoAndStop(2); bgItems.z2.gotoAndStop(2); bgItems.f1._alpha = 0; bgItems.f2._alpha = 0; if (gameMode != 1 && gameMode != 5) { theArrow._alpha = 0; } } if (gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) { if (gameMode != 6) { theSurvivor = 0; char.gotoAndStop(2); } else { theSurvivor = 1; } } if (gameMode == 4 || gameMode == 6 && teacherNum == 13) { bgItems.t1.gotoAndStop(45); bgItems.t2.gotoAndStop(45); bgItems.t3.gotoAndStop(45); } else { bgItems.t1.z1.gotoAndStop(2); bgItems.t2.z1.gotoAndStop(2); bgItems.t3.z1.gotoAndStop(2); } if (gameMode != 5) { hud.bh._alpha = 0; } } function useWeapon(weaponNum) { b = hudBs.length - 1; while (b >= 0) { hudBs[b].gotoAndStop(1); hudVs[b].gotoAndStop(1); --b; } hudBs[weaponNum - 1].gotoAndStop(2); hudVs[weaponNum - 1].gotoAndStop(2); weaponUsed = weaponNum; manageAmmo(); char.charIn.t.o.bow.gotoAndStop(weaponUsed); char.charIn.t.o.arrow.gotoAndStop(weaponUsed); } function firstToUpper(word) { firstLetter = word.substring(1, 0); restOfWord = word.substring(1); return firstLetter.toUpperCase() + restOfWord; } function setStats() { teacher._alpha = 0; im.removeMovieClip(); ib.removeMovieClip(); it2.removeMovieClip(); im2.removeMovieClip(); ib2.removeMovieClip(); charBar.removeMovieClip(); s = statThings.length - 1; while (s >= 0) { statThings[s].removeMovieClip(); statThings.splice(s, 1); --s; } statThings = []; foundBad = false; im = statInfo.attachMovie('itemMiddle', 'itemMiddle' + depth, depth++); im._y = -17.5; ib = statInfo.attachMovie('itemBottom', 'itemBottom' + depth, depth++); eGood = 0; eBad = 0; j = 0; while (j < enemiesOnLevel) { if (enemiesGood[j] || gameMode == 2 || (gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11))) { eGood += 1; enBar = statInfo.attachMovie('enBar', 'enBar' + depth, depth++); enBar._y = 23.5 + 25 * j; statThings.push(enBar); } else { if (!foundBad) { eBad += 1; im._yscale = (j + 1) * 25 - 5; ib._y = -17.5 + im._yscale; foundBad = true; it2 = statInfo.attachMovie('itemTop', 'itemTop' + depth, depth++); it2.teamTxt.htmlText = bold('Team 2'); im2 = statInfo.attachMovie('itemMiddle', 'itemMiddle' + depth, depth++); ib2 = statInfo.attachMovie('itemBottom', 'itemBottom' + depth, depth++); it2._y = 46.5 + j * 25; im2._y = it2._y + 12; im2._yscale = (enemiesOnLevel - j) * 25 - 5; ib2._y = im2._y + im2._yscale; } enBar = statInfo.attachMovie('enBar', 'enBar' + depth, depth++); enBar._y = 72 + 25 * j; statThings.push(enBar); } ++j; } charBar = statInfo.attachMovie('enBar', 'enBar' + depth, depth++); charBar._y = -1.5; charBar.nameTxt.htmlText = yourName; charBar.killsTxt.htmlText = playerKills; charBar.deathsTxt.htmlText = playerDeaths; if (gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) { playerScore = points; } charBar.scoreTxt.htmlText = playerScore; e = enemyKillsAmt.length - 1; while (e >= 0) { if (!enemiesGood[e]) { statThings[e].backing.gotoAndStop(2); } if (gameMode == 2 || (gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11))) { statThings[e].backing.gotoAndStop(3); } statThings[e].backing._alpha = 50; statThings[e].nameTxt.htmlText = firstToUpper(enemyNames[e].toLowerCase()); statThings[e].killsTxt.htmlText = enemyKillsAmt[e]; statThings[e].deathsTxt.htmlText = enemyDeaths[e]; statThings[e].scoreTxt.htmlText = enemyScores[e]; --e; } } function manageTeacher(num) { if (num == teacherNum + 1 && gameMode == 6) { newTeachDelay = 120; if (teacherNum == 12) { newTeachDelay = 300; } teacherNum += 1; teacher._alpha = 100; teacher.talkTxt.htmlText = teacherInformations[num - 1]; teacher.toShow.gotoAndPlay(1); if (teacherNum == 7 || teacherNum == 9) { manageModes(); } if (teacherNum == 10 || teacherNum == 13 || teacherNum == 14) { manageModes(); } if (teacherNum == 12) { char.gotoAndStop(1); } } } function teacherManagement() { if (gameMode == 6) { manageTeacher(1); newTeachDelay -= 1; if (newTeachDelay <= 0) { newTeachDelay = 200; manageTeacher(13); manageTeacher(12); manageTeacher(10); manageTeacher(7); manageTeacher(6); manageTeacher(2); } } else { teacher._alpha = 0; } } function createFunEnemy() { enType = random(4) + 1; en = attachMovie(enemyList[enType - 1], enemyList[enType - 1] + highDepth, highDepth++); en.enType = enType; side = random(4); en.beenOnStage = false; en.Health = 20; en.shootDelay = 30; en.xSpeed = 0; en.ySpeed = 0; en.dir = 0; if (side < 2) { en._x = random(Stage.width - en._width) + en._width / 2; if (side == 1) { en._y = -en._height / 2; en.ySpeed = 5; } else { en._y = Stage.height + en._height / 2; en.ySpeed = -5; } } else { en._y = random(Stage.height - en._height) + en._height / 2; if (side == 3) { en._x = -en._width / 2; en.xSpeed = 5; } else { en._x = Stage.width + en._width / 2; en.xSpeed = -5; } } en.Shadow = attachMovie('shadow', 'shadow' + depth, depth++); en.Shadow._x = en._x; en.Shadow._y = en._y; funEnemies.push(en); } function hypot(a, b) { return Math.sqrt((a._x - b._x) * (a._x - b._x) + (a._y - b._y) * (a._y - b._y)); } function closestPerson(en, returnType) { closestDist = 350; closestPersonA = null; charDist = hypot(char, en); if (charDist <= closestDist) { closestDist = charDist; closestPersonA = char; } e = enemies.length - 1; while (e >= 0) { enemy = enemies[e]; enDist = hypot(enemy, en); if (enDist <= closestDist) { closestDist = enDist; closestPersonA = enemy; } --e; } if (returnType == 1) { return closestPersonA; } else { return closestDist; } } function manageFunEnemies() { funEnDelay -= 1; if (funEnDelay <= 0 && gameMode != 6 && (gameMode == 5 || level > 5)) { funEnDelay = 75 + random(150); if (gameMode == 5) { funEnDelay = 50 + random(100); } createFunEnemy(); } f = funEnemies.length - 1; while (f >= 0) { en = funEnemies[f]; if (!en.beenOnStage) { en._x += en.xSpeed; en._y += en.ySpeed; if (bg.hitTest(en._x - en.xSpeed * 3, en._y - en.ySpeed * 3, true)) { en.beenOnStage = true; en.changeDir = 0; } en._rotation = Math.atan2(en.ySpeed, en.xSpeed) * 180 / Math.PI; } else { if (en._currentframe != 2) { closeP = closestPerson(en, 1); if (en.hitTest(closeP._x, closeP._y, true) && (en.enType == 1 || en.enType == 2)) { en.gotoAndStop(2); } else { en.changeDir -= 1; if (en.changeDir <= 0 && closeP == null) { en.changeDir = 30 + random(50); en.dir = Math.random() * Math.PI * 2; en.xSpeed = Math.cos(en.dir) * 3; en.ySpeed = Math.sin(en.dir) * 3; en._rotation = Math.atan2(en.ySpeed, en.xSpeed) * 180 / Math.PI; } if (closeP != null) { en.shootDelay -= 1; if (en.shootDelay <= 0 && (en.enType == 3 || en.enType == 4)) { en.shootDelay = 30; createFunEnemyArrow(en, random(20) - 10, closeP != char); } var v2 = en._rotation; var v3 = 0; var v5; var v4; v5 = closeP._x - en._x; v4 = closeP._y - en._y; var v6 = Math.atan2(v4, v5); v3 = v6 * 180 / Math.PI; var v1 = (v2 - v3) % 360; if (v1 > 180) { v1 -= 360; } else { if (v1 < -180) { v1 += 360; } } if (Math.abs(v1) < 3) { v2 = v3; } else { if (v1 < 0) { v2 += 5; } else { v2 -= 5; } } en._rotation = v2; en.xSpeed = Math.cos(en._rotation * Math.PI / 180) * 5; en.ySpeed = Math.sin(en._rotation * Math.PI / 180) * 5; theDist = closestPerson(en, 2); if (en.enType == 3 || en.enType == 4) { if (theDist <= 150) { en.xSpeed -= Math.cos(en._rotation * Math.PI / 180) * 8; en.ySpeed -= Math.sin(en._rotation * Math.PI / 180) * 8; en.h.stop(); } else { if (theDist <= 250) { en.xSpeed -= Math.cos(en._rotation * Math.PI / 180) * 5; en.ySpeed -= Math.sin(en._rotation * Math.PI / 180) * 5; en.h.play(); } else { en.xSpeed -= Math.cos(en._rotation * Math.PI / 180) * 2; en.ySpeed -= Math.sin(en._rotation * Math.PI / 180) * 2; en.h.play(); } } } } en._x += en.xSpeed; en._y += en.ySpeed; if (en._x + en._width / 2 >= bg._x + bg._width) { en._x = bg._x + bg._width - en._width / 2; en.xSpeed = -Math.abs(en.xSpeed); } if (en._y + en._height / 2 >= bg._y + bg._height) { en._y = bg._y + bg._height - en._height / 2; en.ySpeed = -Math.abs(en.ySpeed); } if (en._x - en._width / 2 <= bg._x) { en._x = bg._x + en._width / 2; en.xSpeed = Math.abs(en.xSpeed); } if (en._y - en._height / 2 <= bg._y) { en._y = bg._y + en._height / 2; en.ySpeed = Math.abs(en.ySpeed); } } } } if (en._currentframe == 2 && en.inder._currentframe == 14) { closeP = closestPerson(en, 1); if (en.hitTest(closeP.charIn.enBody)) { if (closeP == char) { testAgainst(6); } else { enemy = closeP; enemy.charIn.gotoAndPlay(2); blood = attachMovie('blood', 'blood' + depth, depth++); blood.gotoAndStop(random(4) + 1); blood._x = enemy._x; blood._y = enemy._y; blood._rotation = ar._rotation; bloods.push(blood); dmg = 5 + random(6); enemy.health -= dmg; ahit.start(); damageStuff(enemy, dmg); enemy.hBar.inBar._xscale = (enemy.health / enemy.healthMax) * 100; if (enemy.health <= 0) { if ((gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) && theSurvivor == enemy.ID) { theId = random(enemies.length) + 1; k = enemies.length - 1; while (k >= 0) { if (k == theID) { theSurvivor = enemies[k].ID; enemies[k].gotoAndStop(2); } --k; } } removeEnemy(); } } } } if (bgItems.fieldItems4.hitTest(en._x, en._y, true)) { en._x += en.xSpeed * 1; en._y += en.ySpeed * 1; } if (bgItems.fieldItems2.hitTest(en._x, en._y, true)) { en._x -= en.xSpeed * 0.75; en._y -= en.ySpeed * 0.75; } for (;;) { if (!(bgItems.fieldItems.hitTest(en._x + 10, en._y, true) || bgItems.fieldItems3.hitTest(en._x + 10, en._y, true))) break; en._x -= 0.5; } for (;;) { if (!(bgItems.fieldItems.hitTest(en._x - 10, en._y, true) || bgItems.fieldItems3.hitTest(en._x - 10, en._y, true))) break; en._x += 0.5; } for (;;) { if (!(bgItems.fieldItems.hitTest(en._x, en._y + 10, true) || bgItems.fieldItems3.hitTest(en._x, en._y + 10, true))) break; en._y -= 0.5; } for (;;) { if (!(bgItems.fieldItems.hitTest(en._x, en._y - 10, true) || bgItems.fieldItems3.hitTest(en._x, en._y - 10, true))) break; en._y += 0.5; } en.Shadow._x = en._x; en.Shadow._y = en._y; a = arrows.length - 1; while (a >= 0) { ar = arrows[a]; if (en.hitTest(ar._x, ar._y, true) && ar.hurtsFunEnemies) { blood = attachMovie('blood', 'blood' + depth, depth++); blood.gotoAndStop(random(4) + 1); blood._x = en._x; blood._y = en._y; blood._rotation = ar._rotation; bloods.push(blood); ahit.start(); dmg = approx(ar.Damage); damageStuff(en, dmg); en.Health -= dmg; if (en.Health <= 0) { removeFunEnemy(); } removeArrow(); a = -1; } --a; } --f; } manageEnBullets(); manageDeadEnemies(); } function manageEnBullets() { eb = enBullets.length - 1; while (eb >= 0) { enB = enBullets[eb]; enB._x += enB.xSpeed; enB._y += enB.ySpeed; if (enB._x <= bg._x || enB._y <= bg._y || enB._x >= bg._width + bg._x || enB._y >= bg._height + bg._y) { enB.removeMovieClip(); enBullets.splice(eb, 1); } else { if (char.charIn.enBody.hitTest(enB._x, enB._y, true)) { testAgainst(7); enB.removeMovieClip(); enBullets.splice(eb, 1); } else { e = enemies.length - 1; while (e >= 0) { enemy = enemies[e]; if (enemy.charIn.enBody.hitTest(enB._x, enB._y, true)) { enemy.charIn.gotoAndPlay(2); blood = attachMovie('blood', 'blood' + depth, depth++); blood.gotoAndStop(random(4) + 1); blood._x = enemy._x; blood._y = enemy._y; blood._rotation = ar._rotation; bloods.push(blood); dmg = 3 + random(5); enemy.health -= dmg; ahit.start(); damageStuff(enemy, dmg); enemy.hBar.inBar._xscale = (enemy.health / enemy.healthMax) * 100; if (enemy.health <= 0) { if ((gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) && theSurvivor == enemy.ID) { theId = random(enemies.length) + 1; k = enemies.length - 1; while (k >= 0) { if (k == theID) { theSurvivor = enemies[k].ID; enemies[k].gotoAndStop(2); } --k; } } removeEnemy(); } enB.removeMovieClip(); enBullets.splice(eb, 1); e = -1; } --e; } } } --eb; } } function removeFunEnemy() { if (en.enType == 2) { q = explosionParts.length - 1; while (q >= 0) { pt = attachMovie(explosionParts[q], 'ep' + depth, depth); ++depth; pt._x = en._x; pt._y = en._y; enBullets.push(pt); var v1 = random(10) + 10; var v2 = Math.random() * Math.PI * 2; pt.xSpeed = Math.cos(v2) * v1; pt.ySpeed = Math.sin(v2) * v1; --q; } } shake = 1; explosion = attachMovie('explosion', 'explosion' + highDepth, highDepth++); explosion._x = en._x; explosion._y = en._y; enemyRewards.push(explosion); en.Shadow.removeMovieClip(); deadEnemies.push(en); en.gotoAndStop(3); funEnemies.splice(f, 1); en = null; } function manageDeadEnemies() { d = deadEnemies.length - 1; while (d >= 0) { if (deadEnemies[d]._x == undefined) { deadEnemies.splice(d, 1); } --d; } } function manageHud() { endGame = 0; hud.modeTxt.htmlText = bold(modeNames[gameMode]); if (gameMode == 0) { if (kills >= killsGoal && !gameDone) { endGame = 1; } if (enemyKills >= killsGoal && !gameDone) { endGame = 2; } hud.killsTxt.htmlText = kills + '/' + killsGoal; hud.enemyKillsTxt.htmlText = enemyKills + '/' + killsGoal; hud.gBar._xscale = (kills / killsGoal) * 100; hud.bBar._xscale = (enemyKills / killsGoal) * 100; } if (gameMode == 1 || gameMode == 6 && (teacherNum == 7 || teacherNum == 8)) { if (points >= flagsGoal && !gameDone) { if (enemyPoints == 0) { giveAward(12); } endGame = 1; } if (enemyPoints >= flagsGoal && !gameDone) { endGame = 2; } hud.killsTxt.htmlText = points + '/' + flagsGoal; hud.enemyKillsTxt.htmlText = enemyPoints + '/' + flagsGoal; hud.gBar._xscale = (points / flagsGoal) * 100; hud.bBar._xscale = (enemyPoints / flagsGoal) * 100; } if (gameMode == 2) { if (playerKills >= killsGoal && !gameDone) { endGame = 1; } highestEnKills = 0; e = enemyKillsAmt.length - 1; while (e >= 0) { highestEnKills = enemyKillsAmt[e] >= highestEnKills ? enemyKillsAmt[e] : highestEnKills; --e; } if (highestEnKills >= killsGoal && !gameDone) { endGame = 2; } hud.killsTxt.htmlText = playerKills + '/' + killsGoal; hud.enemyKillsTxt.htmlText = highestEnKills + '/' + killsGoal; hud.gBar._xscale = (playerKills / killsGoal) * 100; hud.bBar._xscale = (highestEnKills / killsGoal) * 100; } if (gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) { if (points >= timeGoal && !gameDone) { endGame = 1; if (perfectSurvivor) { giveAward(13); } } highestEnScore = 0; test = false; e = enemyScores.length - 1; while (e >= 0) { highestEnScore = enemyScores[e] >= highestEnScore ? enemyScores[e] : highestEnScore; --e; } if (highestEnScore >= timeGoal && !gameDone) { endGame = 2; } hud.killsTxt.htmlText = Math.floor(points / 30) + '/' + Math.floor(timeGoal / 30); hud.enemyKillsTxt.htmlText = Math.floor(highestEnScore / 30) + '/' + Math.floor(timeGoal / 30); hud.gBar._xscale = (points / timeGoal) * 100; hud.bBar._xscale = (highestEnScore / timeGoal) * 100; } if ((gameMode == 4 || gameMode == 6 && teacherNum == 13) && !playerPause) { t = territories.length - 1; while (t >= 0) { hudTs[t]._alpha = 100; territory = territories[t]; if (territory._currentframe == 45) { hudTs[t].gotoAndStop(1); } else { if (territory._currentframe < 10) { if (!gameDone) { points += 1; } hudTs[t].gotoAndStop(2); } if (territory._currentframe > 45) { if (!gameDone) { enemyPoints += 1; } hudTs[t].gotoAndStop(3); } } --t; } if (points >= pointsGoal && !gameDone) { endGame = 1; } if (enemyPoints >= pointsGoal && !gameDone) { endGame = 2; } hud.killsTxt.htmlText = Math.floor(points / 30) + '/' + Math.floor(pointsGoal / 30); hud.enemyKillsTxt.htmlText = Math.floor(enemyPoints / 30) + '/' + Math.floor(pointsGoal / 30); hud.gBar._xscale = (points / pointsGoal) * 100; hud.bBar._xscale = (enemyPoints / pointsGoal) * 100; } else { t = hudTs.length - 1; while (t >= 0) { hudTs[t]._alpha = 0; --t; } } if (gameMode == 5) { if (char.respawnTime > 150 && !gameDone) { endGame = 2; } if (dragonKilled && !gameDone) { endGame = 1; } } if (gameMode == 6 && teacherNum == 14) { if (!gameDone) { endGame = 1; } } if (endGame == 0 || gameMode == 6 && teacherNum < 14) { } else { if (!skirmishMode) { setStats(); rada._alpha = 0; gameDone = true; t1.play(); t1.tt.winLose.gotoAndStop(endGame); if (endGame == 2) { level -= 1; } char.hBar._alpha = 0; e = enemies.length - 1; while (e >= 0) { enemies[e].hBar._alpha = 0; --e; } statInfo._x = Stage.width / 2; } else { removeGame(); gotoAndStop(3); } } b = hudBs.length - 1; while (b >= 0) { hudVs[b].ammoTxt.htmlText = ammos[b]; if (ammos[b] > 0 || b == 0) { hudVs[b]._alpha = 100; hudBs[b]._alpha = 100; } else { hudVs[b]._alpha = 20; hudBs[b]._alpha = 20; } if (b == 0) { hudVs[b].ammoTxt.htmlText = '∞'; } if (hudBs[b]._currentframe == 1) { hudSpeeds[b] += (75 - hudBs[b]._xscale) / 10; } if (hudBs[b]._currentframe == 2) { hudSpeeds[b] += (100 - hudBs[b]._xscale) / 10; } if (b != 0) { hudBs[b]._x = hudBs[b - 1]._x + 10 + hudVs[b]._width / 2 + hudVs[b - 1]._width / 2; hudVs[b]._x = hudBs[b]._x; } hudSpeeds[b] *= 0.8; hudVs[b]._yscale += hudSpeeds[b]; hudVs[b]._xscale = hudVs[b]._yscale; hudBs[b]._yscale = hudVs[b]._yscale; hudBs[b]._xscale = hudVs[b]._yscale; --b; } hud.abilityTxt.htmlText = bold(abilityNames[ability - 1]); if (ability == 0) { hud.abilityTxt.htmlText = bold(''); hud.sBar._alpha = 0; hud.aBar._alpha = 0; } else { hud.sBar._alpha = 100; hud.aBar._alpha = 100; } hud.aBar.a1._xscale = (abilityLeft / abilityMax) * 100; } function findExactPoint(object, pointX, pointY, degrees, stageIn, distToTravel) { if (stageIn == 10) { pointHolder = new Object(); pointHolder.xPoint = pointX; pointHolder.yPoint = pointY; return pointHolder; } didHit = object.hitTest(pointX, pointY, true); if (!didHit) { return findExactPoint(object, pointX + Math.cos(degrees * Math.PI / 180) * distToTravel * 1, pointY + Math.sin(degrees * Math.PI / 180) * distToTravel * (didHit ? -1 : 1), degrees, stageIn + 1, distToTravel / 2); } return findExactPoint(object, pointX + Math.cos(degrees * Math.PI / 180) * distToTravel * -1, pointY + Math.sin(degrees * Math.PI / 180) * distToTravel * (didHit ? -1 : 1), degrees, stageIn + 1, distToTravel / 2); } function findAngle(object, middlePointX, middlePointY, radius, degrees, stageIn, didHit) { if (stageIn == 10) { return degrees; } newPointX = middlePointX + Math.cos(degrees * Math.PI / 180) * radius; newPointY = middlePointY + Math.sin(degrees * Math.PI / 180) * radius; didHit = object.hitTest(newPointX, newPointY, true); if (!didHit) { angle = findAngle(object, middlePointX, middlePointY, radius, degrees + -(180 / Math.pow(2, stageIn)), stageIn + 1, didHit); return angle; } angle = findAngle(object, middlePointX, middlePointY, radius, degrees + 180 / Math.pow(2, stageIn), stageIn + 1, didHit); return angle; } function findNewDirection(arrowDir, objectDir) { newDir = arrowDir - objectDir; return (objectDir + 180 - newDir) * -1; } function pointTheArrow(objecter, pointer, deger) { thePoint = findExactPoint(objecter, pointer._x, pointer._y, 360 - deger, 1, 50); return findNewDirection(Math.atan2(pointer._y - thePoint.yPoint, pointer._x - thePoint.xPoint) * 180 / Math.PI, findAngle(objecter, thePoint.xPoint, thePoint.yPoint, 5, deger, 1, true)); } function startGens() { g = genSpots.length - 1; while (g >= 0) { genSpot = genSpots[g]; pick = 0; theN = random(100) + 1; l = 0; while (l < genChances.length) { theN -= genChances[l]; if (theN <= 0) { pick = l; break; } ++l; } genSpot.newWepDelay = newWepDelayConst; spotPick = pick + 2; if (spotPick <= 6) { genSpot.gotoAndStop(spotPick); genSpot.t1.gotoAndStop(2); } else { if (spotPick == 7) { genSpot.gotoAndStop(13); } } --g; } } function enemyUseWeapon(weaponNum) { enemy.weaponUsed = weaponNum; enemy.charIn.t.o.bow.gotoAndStop(enemy.weaponUsed); enemy.charIn.t.o.arrow.gotoAndStop(enemy.weaponUsed); } function manageBowPickups() { g = genSpots.length - 1; while (g >= 0) { genSpot = genSpots[g]; if (genSpot._currentframe != 1) { if (genSpot.hitTest(char.charIn.enBody)) { if (genSpot._currentframe == 13) { health += 50; if (health >= healthMax) { health = healthMax; } char.hBar.inBar._xscale = (health / healthMax) * 100; } else { if (genSpot._currentframe >= weaponUsed) { useWeapon(genSpot._currentframe); } ammos[genSpot._currentframe - 1] += weaponAmmos[weaponLevels[2][genSpot._currentframe - 1]][genSpot._currentframe - 1]; if (ammos[genSpot._currentframe - 1] >= 32) { ammos[genSpot._currentframe - 1] = 32; } manageAmmo(); } genSpot.gotoAndStop(1); } e = enemies.length - 1; while (e >= 0) { enemy = enemies[e]; if (genSpot.hitTest(enemy.charIn.enBody)) { if (genSpot._currentframe == 13) { enemy.health += 50; if (enemy.health > 100) { enemy.health = 100; } enemy.hBar.inBar._xscale = (enemy.health / enemy.healthMax) * 100; } else { enemy.ammos[genSpot._currentframe - 1] += 30; enemyUseWeapon(genSpot._currentframe); } genSpot.gotoAndStop(1); } --e; } } else { genSpot.newWepDelay -= 1; if (genSpot.newWepDelay <= 0) { genSpot.newWepDelay = newWepDelayConst; pick = 0; theN = random(100) + 1; l = 0; while (l < genChances.length) { theN -= genChances[l]; if (theN <= 0) { pick = l; break; } ++l; } genSpot.newWepDelay = newWepDelayConst; spotPick = pick + 2; if (spotPick <= 6) { genSpot.gotoAndStop(spotPick); genSpot.t1.gotoAndStop(2); } else { if (spotPick == 7) { genSpot.gotoAndStop(13); } } } } --g; } } function changeArmor(archer, frame) { archer.charIn.t.o.q.gotoAndStop(frame); archer.charIn.t.o.w.gotoAndStop(frame); archer.charIn.t.o.e.gotoAndStop(frame); archer.charIn.t.o.r.gotoAndStop(frame); archer.charIn.hat.gotoAndStop(frame); archer.charIn.w.w.gotoAndStop(frame); archer.charIn.q.f.gotoAndStop(frame); archer.charIn.q.d.gotoAndStop(frame); } function characterManagement() { if (money == NaN) { money = lastMoney; } else { lastMoney = money; } if (frozen) { frozenDelay -= 1; if (frozenDelay <= 0) { frozen = false; } } rotter = char._rotation; dirX = 0; dirY = 0; isMoving = false; if (Key.isDown(32)) { if (!spacePressed) { abilityOn = !abilityOn; spacePressed = true; } } else { spacePressed = false; } if (abilityOn) { abilityLeft -= 10; if (abilityLeft <= 0) { abilityLeft = 0; abilityOn = false; } } else { abilityLeft += 2; if (abilityLeft >= abilityMax) { abilityLeft = abilityMax; } } if (char.respawnTime < 0) { if (abilityOn && ability == 1 || char.respawnTime > 0) { char._alpha = 30; } else { char._alpha = 100; } } if (abilityOn && ability == 3) { char.shield._alpha = 100; } else { char.shield._alpha = 0; } if (Key.isDown(39) || Key.isDown(68)) { isMoving = true; dirX += 1; } if (Key.isDown(37) || Key.isDown(65)) { isMoving = true; dirX -= 1; } if (Key.isDown(38) || Key.isDown(87)) { isMoving = true; dirY -= 1; } if (Key.isDown(40) || Key.isDown(83)) { isMoving = true; dirY += 1; } if (isMoving && !frozen) { xSpeed += Math.cos(Math.atan2(dirY, dirX)) * speed; ySpeed += Math.sin(Math.atan2(dirY, dirX)) * speed; } if (bgItems.fieldItems4.hitTest(char._x, char._y, true)) { xSpeed *= 0.8; ySpeed *= 0.8; } else { if (bgItems.fieldItems2.hitTest(char._x, char._y, true)) { xSpeed *= 0.6; ySpeed *= 0.6; } else { if (bgItems.fieldItems5.hitTest(char._x, char._y, true)) { testAgainst(4); xSpeed *= 0.6; ySpeed *= 0.6; } else { xSpeed *= friction; ySpeed *= friction; } } } if (!isDead) { if (char.respawnTime <= 0) { char._x += xSpeed; char._y += ySpeed; if (abilityOn && ability == 2) { char._x += xSpeed * 0.5; char._y += ySpeed * 0.5; } } } else { deadDelay -= 1; if (deadDelay <= 0) { isDead = false; char._alpha = 100; char.Shadow._alpha = 100; rings._alpha = 100; char.hBar._alpha = 100; createParticles(20, mainAppear); mainAppear.removeMovieClip(); } } for (;;) { if (!(bgItems.fieldItems.hitTest(char._x + 10, char._y, true) || bgItems.fieldItems3.hitTest(char._x + 10, char._y, true))) break; char._x -= 0.5; } for (;;) { if (!(bgItems.fieldItems.hitTest(char._x - 10, char._y, true) || bgItems.fieldItems3.hitTest(char._x - 10, char._y, true))) break; char._x += 0.5; } for (;;) { if (!(bgItems.fieldItems.hitTest(char._x, char._y + 10, true) || bgItems.fieldItems3.hitTest(char._x, char._y + 10, true))) break; char._y -= 0.5; } for (;;) { if (!(bgItems.fieldItems.hitTest(char._x, char._y - 10, true) || bgItems.fieldItems3.hitTest(char._x, char._y - 10, true))) break; char._y += 0.5; } if (char._x >= bg._x + bg.rb._width - 10) { char._x = bg._x + bg.rb._width - 10; giveAward(9); } if (char._y >= bg._y + bg.rb._height - 10) { char._y = bg._y + bg.rb._height - 10; giveAward(9); } if (char._x <= bg._x + 10) { char._x = bg._x + 10; giveAward(9); } if (char._y <= bg._y + 10) { char._y = bg._y + 10; giveAward(9); } if (char.charIn.enBody.hitTest(bg.bgIn.pp1)) { if (!teledTo1) { bg.bgIn.pp1.play(); if (bg.bgIn.pp1._currentframe == 15) { char._x = bg._x + bg.bgIn.pp2._x; char._y = bg._y + bg.bgIn.pp2._y; teledTo2 = true; } } } else { teledTo1 = false; } if (char.charIn.enBody.hitTest(bg.bgIn.pp2)) { if (!teledTo2) { bg.bgIn.pp2.play(); if (bg.bgIn.pp2._currentframe == 15) { char._x = bg._x + bg.bgIn.pp1._x; char._y = bg._y + bg.bgIn.pp1._y; teledTo1 = true; } } } else { teledTo2 = false; } if (char.charIn.enBody.hitTest(bg.bgIn.pp3)) { if (!teledTo3) { bg.bgIn.pp3.play(); if (bg.bgIn.pp3._currentframe == 15) { char._x = bg._x + bg.bgIn.pp4._x; char._y = bg._y + bg.bgIn.pp4._y; teledTo4 = true; } } } else { teledTo3 = false; } if (char.charIn.enBody.hitTest(bg.bgIn.pp4)) { if (!teledTo4) { bg.bgIn.pp4.play(); if (bg.bgIn.pp4._currentframe == 15) { char._x = bg._x + bg.bgIn.pp3._x; char._y = bg._y + bg.bgIn.pp3._y; teledTo3 = true; } } } else { teledTo4 = false; } xChange = bg._x; yChange = bg._y; bg._x -= char._x - Stage.width / 2; bg._y -= char._y - stageHeight / 2; char._x = Stage.width / 2; char._y = stageHeight / 2; if (bg._x >= 0) { char._x -= bg._x; bg._x = 0; } if (bg._y >= 0) { char._y -= bg._y; bg._y = 0; } if (bg._x <= Stage.width - bg.rb._width) { char._x -= bg._x - (Stage.width - bg.rb._width); bg._x = Stage.width - bg.rb._width; } if (bg._y <= stageHeight - bg.rb._height) { char._y -= bg._y - (stageHeight - bg.rb._height); bg._y = stageHeight - bg.rb._height; } if (Math.abs(xSpeed) + Math.abs(ySpeed) < 2) { char.charIn.w.stop(); char.charIn.q.stop(); } else { char.charIn.w.play(); char.charIn.q.play(); char.charIn.q._rotation = Math.atan2(ySpeed, xSpeed) * 180 / Math.PI - char._rotation - 90; } char.Shadow._x = char._x; char.Shadow._y = char._y; char.hBar._x = char._x; char.hBar._y = char._y - 40; if (frozen) { bg._x = xChange; bg._y = yChange; } xChange -= bg._x; yChange -= bg._y; rings._x = char._x; rings._y = char._y; if (im._x == undefined && rada._alpha > 1) { if (char._x >= Stage.width / 2 + 100 && char._y <= Stage.height / 2 - 100) { rada._alpha = 50; } else { rada._alpha = 100; } } else { rada._alpha = 0; } char.respawnTime -= 1; if (char.respawnTime == 0) { tempHolder = random(goodPortals.length + nuetralPortals.length); portalShow = tempHolder >= goodPortals.length ? nuetralPortals[tempHolder - goodPortals.length] : goodPortals[tempHolder]; bgX = bg._x; bgY = bg._y; bg._x = -enemyPortals[portalShow - 1]._x; bg._y = -enemyPortals[portalShow - 1]._y; bgItems._x = -enemyPortals[portalShow - 1]._x; bgItems._y = -enemyPortals[portalShow - 1]._y; char._x = bgItems._x + enemyPortals[portalShow - 1]._x; char._y = bgItems._y + enemyPortals[portalShow - 1]._y; moveEverything(bgX - bg._x, bgY - bg._y); c = arrows.length - 1; while (c >= 0) { arrows[c].removeMovieClip(); arrows.splice(c, 1); --c; } mainAppear = bgItems.attachMovie('appear', 'appear' + highDepth, highDepth++); mainAppear._x = enemyPortals[portalShow - 1]._x; mainAppear._y = enemyPortals[portalShow - 1]._y; isDead = true; char._alpha = 0; killsWithoutDeath = 0; deadDelay = 30; health = healthMax; char.hBar.inBar._xscale = (health / healthMax) * 100; } arrowManagement(); } function approx(num) { range = 0.3; return Math.round(num + Math.random() * (num * range) - num * range / 2); } function manageLoss() { if (!mDown && wasMDown && gameDone && t1._currentframe == 50 && hasReleased) { createShop(); if (level == levelsUnlocked) { levelsUnlocked += 1; if (level == 21) { removeGame(); gotoAndStop(9); } } if (level != 21) { saveGame(); t1.gotoAndStop(1); gamePause = true; } } if (t1._currentframe >= 49) { if (!mDown) { hasReleased = true; } } } function manageGameModes() { if (gameMode == 1 || gameMode == 6 && (teacherNum == 7 || teacherNum == 8)) { theArrow._x = char._x; theArrow._y = char._y; if (enemyFlagState == 1) { theArrow._alpha = 100; theArrow._rotation = Math.atan2(bgItems._y + bgItems.f2._y - char._y, bgItems._x + bgItems.f2._x - char._x) * 180 / Math.PI; if (char.hitTest(bgItems.f2)) { bgItems.f2._alpha = 0; char.flager = attachMovie('flag', 'flag' + highDepth, highDepth++); char.flager.f1.gotoAndStop(2); char.hasFlag = true; manageTeacher(8); enemyFlagState = 2; startInfo(7); } } if (enemyFlagState == 2) { theArrow._alpha = 100; theArrow._rotation = Math.atan2(bgItems._y + bgItems.f1._y - char._y, bgItems._x + bgItems.f1._x - char._x) * 180 / Math.PI; char.flager._x = char._x; char.flager._y = char._y - 60; if (char.hitTest(bgItems.f1)) { manageTeacher(9); if (!gameDone) { playerScore += 1; points += 1; } char.flager.removeMovieClip(); enemyFlagState = 1; bgItems.f2._alpha = 100; startInfo(8); } } if (enemyFlagState == 3) { f = flags.length - 1; while (f >= 0) { flag = flags[f]; if (!flag.isGood) { theArrow._alpha = 100; theArrow._rotation = Math.atan2(flag._y - char._y, flag._x - char._x) * 180 / Math.PI; } if (char.hitTest(flag) && char._alpha >= 50) { if (!flag.isGood) { startInfo(9); char.hasFlag = true; char.flager = attachMovie('flag', 'flag' + highDepth, highDepth++); char.flager.f1.gotoAndStop(2); char.hasFlag = true; enemyFlagState = 2; removeFlag(); } else { startInfo(10); removeFlag(); bgItems.f1._alpha = 100; flagState = 1; } } --f; } } } if (gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) { if (theSurvivor == -1) { tHold = random(enemies.length); theSurvivor = enemies[tHold].ID; enemies[tHold].gotoAndStop(2); if (enemies.length == 0) { theSurvivor = 0; char.gotoAndStop(2); } } if (theSurvivor == 0) { theArrow._alpha = 0; if (!gameDone) { points += 1; } } else { theArrow._alpha = 100; theArrow._x = char._x; theArrow._y = char._y; foundEnemy = false; e = enemies.length - e; while (e >= 0) { enemy = enemies[e]; if (enemy.ID == theSurvivor) { theArrow._rotation = Math.atan2(enemy._y - char._y, enemy._x - char._x) * 180 / Math.PI; if (enemy == undefined) { enemies.splice(e, 1); } else { foundEnemy = true; } } --e; } if (!foundEnemy) { theArrow._alpha = 0; foundDelay += 1; if (foundDelay >= 100) { foundDelay = 0; sPicked = random(enemies.length + 1); if (sPicked == 0) { theSurvivor = 0; char.gotoAndStop(2); } else { theSurvivor = enemies[sPicked - 1].ID; enemies[sPicked - 1].gotoAndStop(2); } } } else { foundDelay = 0; } if (!gameDone && gameMode != 6) { enemyScores[theSurvivor - 1] += 1; } } } if (gameMode == 4 || gameMode == 6 && teacherNum == 13) { theArrow._alpha = 100; theArrow._x = char._x; theArrow._y = char._y; ct = findClosestTerritory(char, true); if (ct == null) { theArrow._alpha = 0; manageTeacher(14); endGame = 1; } else { theArrow._rotation = Math.atan2(ct._y + bgItems._y - char._y, ct._x + bgItems._x - char._x) * 180 / Math.PI; } t = territories.length - 1; while (t >= 0) { territory = territories[t]; if (char.hitTest(territory)) { if (territory._currentframe == 44) { startInfo(26 + t); } if (territory._currentframe != 1) { territory.prevFrame(); } } e = enemies.length - 1; while (e >= 0) { enemy = enemies[e]; if (enemy.hitTest(territory)) { if (enemy.isGood) { if (territory._currentframe == 44) { startInfo(26 + t); } if (territory._currentframe != 1) { territory.prevFrame(); } } else { if (territory._currentframe == 46) { startInfo(29 + t); } if (territory._currentframe != 90) { territory.nextFrame(); } } } --e; } --t; } } if (gameMode == 5) { fireBallDelay -= 1; if (fireBallDelay == 50 || fireBallDelay == 40 || fireBallDelay == 30 || fireBallDelay == 20 || fireBallDelay == 10 || fireBallDelay == 0) { createFireBall(fireBallDelay * 12); } if (fireBallDelay <= 0) { fireBallDelay = 100 + random(200); } } } function createFireBall(yVal) { createFunEnemyArrow(null, yVal, false); } function findClosestTerritory(playr, good) { closestTerritory = null; closestDist = 10000; t = territories.length - 1; while (t >= 0) { ter = territories[t]; dist = Math.sqrt((playr._x - (ter._x + bgItems._x)) * (playr._x - (ter._x + bgItems._x)) + (playr._y - (ter._y + bgItems._y)) * (playr._y - (ter._y + bgItems._y))); if (dist <= closestDist && (ter._currentframe >= 15 && good || ter._currentframe <= 75 && !good)) { closestDist = dist; closestTerritory = ter; } --t; } return closestTerritory; } function removeFlag() { flag.removeMovieClip(); flags.splice(f, 1); } function createDragon() { dragon = attachMovie('dragon', 'dragon' + highDepth, highDepth++); dragon._yscale = 40; dragon._xscale = 40; dragon.Type = 1; if (level > 10) { dragon.Type = 2; dragon.gotoAndStop(11); } if (level > 18) { dragon.Type = 3; dragon.gotoAndStop(21); } dragon.State = 1; dragon.revertDelay = 90; dragon.walkSpeed = 5; dragon.flySpeed = 10; dragon.xSpeed = 0; dragon.ySpeed = 0; dragon.healthMax = dragonHealthMaxes[dragon.Type - 1]; dragon.health = dragon.healthMax; dragon.dIn.gotoAndStop(4); dragons.push(dragon); } function dragonManagement() { if (dragons.length < dragonMax && gameMode == 5 && !dragonKilled) { createDragon(); } d = dragons.length - 1; while (d >= 0) { dragon = dragons[d]; if (hypot(dragon, char) >= 400) { theArrow._alpha = 100; theArrow._rotation = Math.atan2(dragon._y - char._y, dragon._x - char._x) * 180 / Math.PI; theArrow._x = char._x; theArrow._y = char._y; } else { theArrow._alpha = 0; } if (hypot(dragon, char) <= 150 && dragon.State != 3) { if (Math.abs((dragon._rotation - Math.atan2(char._y - dragon._y, char._x - dragon._x) * 180 / Math.PI) % 360) <= 90) { dragon.State = 3; dragon.dIn.gotoAndStop(2); } } if (hypot(dragon, char) <= 250 && dragon.State != 3) { if (Math.abs((dragon._rotation - Math.atan2(char._y - dragon._y, char._x - dragon._x) * 180 / Math.PI) % 360) <= 30) { dragon.State = 3; dragon.dIn.gotoAndStop(3); } } hud.bh.tBar._xscale = (dragon.health / dragon.healthMax) * 100; if (dragon.State != 3) { if (hypot(dragon, char) < 500) { dragon.State = 4; } else { if (dragon.State != 2) { dragon.State = 1; } } } if (dragon.State == 1 && random(30) == 0) { dragon.State = 2; dir = (random(360) / 180) * Math.PI; if (random(2) == 0) { dragon.xSpeed = Math.cos(dir) * dragon.walkSpeed; dragon.ySpeed = Math.sin(dir) * dragon.walkSpeed; dragon.dIn.gotoAndStop(1); } else { dragon.xSpeed = Math.cos(dir) * dragon.flySpeed; dragon.ySpeed = Math.sin(dir) * dragon.flySpeed; dragon.dIn.gotoAndStop(6); } dragon._rotation = dir * 180 / Math.PI; } if (dragon.State == 2) { dragon._x += dragon.xSpeed; dragon._y += dragon.ySpeed; if (dragon._y <= bg._y + dragon._height / 2) { dragon.ySpeed *= -1; dragon._y = bg._y + dragon._height / 2; dragon._rotation = Math.atan2(dragon.ySpeed, dragon.xSpeed) * 180 / Math.PI; } if (dragon._y >= bg._y + bg.rb._height - dragon._height / 2) { dragon.ySpeed *= -1; dragon._y = bg._y + bg.rb._height - dragon._height / 2; dragon._rotation = Math.atan2(dragon.ySpeed, dragon.xSpeed) * 180 / Math.PI; } if (dragon._x <= bg._x + dragon._width / 2) { dragon.xSpeed *= -1; dragon._x = bg._x + dragon._width / 2; dragon._rotation = Math.atan2(dragon.ySpeed, dragon.xSpeed) * 180 / Math.PI; } if (dragon._x >= bg._x + bg.rb._width - dragon._width / 2) { dragon.xSpeed *= -1; dragon._x = bg._x + bg.rb._width - dragon._width / 2; dragon._rotation = Math.atan2(dragon.ySpeed, dragon.xSpeed) * 180 / Math.PI; } dragon.revertDelay -= 1; if (dragon.revertDelay <= 0) { dragon.State = 1; dragon.revertDelay = 90; dragon.dIn.gotoAndStop(4); } } if (dragon.State == 3) { if (dragon.dIn.d1._currentframe == 13) { if (char.hitTest(dragon.dIn.d1.hBox)) { testAgainst(3); } } if (dragon.dIn._currentframe == 4) { dragon.State = 1; } } if (dragon.State == 4) { dragon.dIn.gotoAndStop(6); tempRot = dragon._rotation; qx2 = char._x - dragon._x; qy2 = char._y - dragon._y; radians = Math.atan2(qy2, qx2); tempTurn = radians * 180 / Math.PI; diffRot = (tempRot - tempTurn) % 360; if (diffRot > 180) { diffRot -= 360; } else { if (diffRot < -180) { diffRot += 360; } } if (Math.abs(diffRot) < 5) { tempRot = tempTurn; } else { if (diffRot < 0) { tempRot += 5; } else { tempRot -= 5; } } dragon._rotation = tempRot; dragon._x += Math.cos(dragon._rotation * Math.PI / 180) * 10; dragon._y += Math.sin(dragon._rotation * Math.PI / 180) * 10; } --d; } } function removeDragon() { dragonKilled = true; dragon.removeMovieClip(); dragons.splice(d, 1); } function createSmoke(n) { smoke = attachMovie('smoke', 'smokes' + depth, depth++); smoke.p1.gotoAndStop(n); smoke._x = char._x + (Math.random() * 20 - 10); smoke._y = char._y + (Math.random() * 20 - 10); smoke._yscale = random(50) + 50; smoke._xscale = smoke._yscale; smokes.push(smoke); } function smokeManagement() { smokeDelay -= 1; if (smokeDelay <= 0 && Math.abs(xSpeed) + Math.abs(ySpeed) > 3) { smokeDelay = 3; manageTeacher(3); if (bgItems.fieldItems4.hitTest(char._x, char._y, true)) { createSmoke(4); } else { createSmoke(3); } } s = smokes.length - 1; while (s >= 0) { smoke = smokes[s]; if (smoke._currentframe == 19 || smoke._x == undefined) { smokes[s].removeMovieClip(); smokes.splice(s, 1); } --s; } } function onEnterFrame() { rada.rada._rotation -= 10; qx = _xmouse - char._x; qy = _ymouse - char._y; if (qx != 0 || qy != 0) { radians = Math.atan2(qy, qx); topRotation = radians * 180 / Math.PI; } char._rotation = topRotation; if (!gameStarted) { if (tran._currentframe == 60) { countDown.play(); } if (!counting && !inShop) { tran.removeMovieClip(); gameStarted = true; gamePause = false; if (gameMode == 6) { teacherNum = 0; startInfo(33); } else { startInfo(gameMode + 1); } } } if (countDown._currentframe == 21 && countDown.t1._currentframe == 4) { countDown.removeMovieClip(); counting = false; } framesPlayed += 1; timeToNextKill -= 1; if (timeToNextKill <= 0) { killStreak = 0; } if (framesPlayed / 30 / 60 >= 15) { giveAward(6); if (framesPlayed / 30 / 60 >= 120) { giveAward(7); } } awardWait(); manageHud(); if (!gamePause && !playerPause && !screenOn) { bg._x = bg.StoreX; bg._y = bg.StoreY; characterManagement(); manageFunEnemies(); manageBowPickups(); enemyManagement(); particleManagement(); smokeManagement(); teacherManagement(); manageLoss(); manageGameModes(); manageDamages(); dragonManagement(); explosionManagement(); moveEverything(xChange, yChange); bg.StoreX = bg._x; bg.StoreY = bg._y; bg._x = Math.floor(bg._x); bg._y = Math.floor(bg._y); bgItems._x = bg._x; bgItems._y = bg._y; } shaker(); wasMDown = mDown; } function moveEverything(xer, yer) { d = dragons.length - 1; while (d >= 0) { dragon = dragons[d]; dragon._x -= xer; dragon._y -= yer; --d; } d = dis.length - 1; while (d >= 0) { di = dis[d]; di._x -= xer; di._y -= yer; --d; } f = flags.length - 1; while (f >= 0) { flag = flags[f]; flag._x -= xer; flag._y -= yer; --f; } a = arrows.length - 1; while (a >= 0) { ar = arrows[a]; ar._x -= xer; ar._y -= yer; --a; } e = enemies.length - 1; while (e >= 0) { en = enemies[e]; en._x -= xer; en._y -= yer; --e; } f = funEnemies.length - 1; while (f >= 0) { en = funEnemies[f]; en._x -= xer; en._y -= yer; --f; } p = particles.length - 1; while (p >= 0) { pa = particles[p]; pa._x -= xer; pa._y -= yer; --p; } s = smokes.length - 1; while (s >= 0) { smoke = smokes[s]; smoke._x -= xer; smoke._y -= yer; --s; } e = enBullets.length - 1; while (e >= 0) { enB = enBullets[e]; enB._x -= xer; enB._y -= yer; --e; } d = deadEnemies.length - 1; while (d >= 0) { de = deadEnemies[d]; de._x -= xer; de._y -= yer; --d; } b = bloods.length - 1; while (b >= 0) { blood = bloods[b]; blood._x -= xer; blood._y -= yer; --b; } e = enemyRewards.length - 1; while (e >= 0) { er = enemyRewards[e]; er._x -= xer; er._y -= yer; --e; } f = floorShots.length - 1; while (f >= 0) { fs = floorShots[f]; fs._x -= xer; fs._y -= yer; --f; } e = explosions.length - 1; while (e >= 0) { exp = explosions[e]; exp._x -= xer; exp._y -= yer; --e; } } function clearScreen() { flags = new Array(); a = specArrows.length - 1; while (a >= 0) { specArrow = specArrows[a]; specArrow.removeMovieClip(); specArrows.splice(a, 1); --a; } d = dragons.length - 1; while (d >= 0) { dragon = dragons[d]; dragon.removeMovieClip(); dragons.splice(d, 1); --d; } d = dis.length - 1; while (d >= 0) { di = dis[d]; di.removeMovieClip(); dis.splice(d, 1); --d; } f = flags.length - 1; while (f >= 0) { flag = flags[f]; flag.removeMovieClip(); flags.splice(f, 1); --f; } a = arrows.length - 1; while (a >= 0) { ar = arrows[a]; ar.removeMovieClip(); arrows.splice(a, 1); --a; } e = enemies.length - 1; while (e >= 0) { enemy = enemies[e]; removeEnemy(); --e; } f = funEnemies.length - 1; while (f >= 0) { en = funEnemies[f]; en.Shadow.removeMovieClip(); en.removeMovieClip(); funEnemies.splice(f, 1); --f; } p = particles.length - 1; while (p >= 0) { pa = particles[p]; pa.removeMovieClip(); particles.splice(p, 1); --p; } s = smokes.length - 1; while (s >= 0) { sm = smokes[s]; sm.removeMovieClip(); smokes.splice(s, 1); --s; } e = enBullets.length - 1; while (e >= 0) { enB = enBullets[e]; enB.removeMovieClip(); enBullets.splice(e, 1); --e; } d = deadEnemies.length - 1; while (d >= 0) { de = deadEnemies[d]; de.removeMovieClip(); deadEnemies.splice(d, 1); --d; } b = bloods.length - 1; while (b >= 0) { blood = bloods[b]; blood.removeMovieClip(); bloods.splice(b, 1); --b; } e = enemyRewards.length - 1; while (e >= 0) { er = enemyRewards[e]; er.removeMovieClip(); enemyRewards.splice(e, 1); --e; } f = floorShots.length - 1; while (f >= 0) { fs = floorShots[f]; fs.removeMovieClip(); fs.splice(f, 1); --f; } e = explosions.length - 1; while (e >= 0) { exp = explosions[e]; exp.removeMovieClip(); explosions.splice(e, 1); --e; } } function removeGame() { loop.stop(); teacher.removeMovieClip(); char.Shadow.removeMovieClip(); countDown.removeMovieClip(); pbtn.removeMovieClip(); mbtn.removeMovieClip(); qbtn.removeMovieClip(); hbtn.removeMovieClip(); tran.removeMovieClip(); award.removeMovieClip(); hBar.removeMovieClip(); char.removeMovieClip(); bgItems.removeMovieClip(); rings.removeMovieClip(); hud.removeMovieClip(); tellInfo.removeMovieClip(); t1.removeMovieClip(); statInfo.removeMovieClip(); theArrow.removeMovieClip(); helpScreen.removeMovieClip(); to1.removeMovieClip(); rada.removeMovieClip(); shop.removeMovieClip(); clearScreen(); } function manageAmmo() { if (ammos[weaponUsed - 1] <= 5 && weaponUsed != 1) { hud.lowImg._alpha = 100; } else { hud.lowImg._alpha = 0; } d = ammoMCs.length; while (d < ammos[weaponUsed - 1]) { ammo = hud.attachMovie('ammo', 'ammo' + depth, depth++); ammo._x = 252 + d * 3; ammo._y = 18; ammoMCs.push(ammo); ++d; } d = ammoMCs.length - 1; while (d >= ammos[weaponUsed - 1]) { ammoMCs[d].removeMovieClip(); ammoMCs.splice(d, 1); --d; } } function damageStuff(object, num) { di = attachMovie('damageInfo', 'damgaeInfo' + higherDepth, higherDepth++); di._x = object._x; di._y = object._y - 10; di.d1.damageTxt.htmlText = bold(num); dis.push(di); } function manageDamages() { d = dis.length - 1; while (d >= 0) { di = dis[d]; if (di._currentframe == 25) { di.removeMovieClip(); dis.splice(d, 1); } --d; } } function arrowManagement() { shotDelay -= 1; if (mDown && shotDelay <= 0 && !isDead && char.respawnTime <= 0 && !frozen) { manageTeacher(4); if (ammos[weaponUsed - 1] > 0 || weaponUsed == 1) { ammos[weaponUsed - 1] -= 1; manageAmmo(); ashot.start(); if (abilityOn && ability == 1) { abilityOn = false; } if (weaponUsed != 2 && weaponUsed != 5 && weaponUsed != 3) { createArrow(0); } if (weaponUsed == 2) { createArrow(random(40) - 20); createArrow(random(40) - 20); createArrow(random(40) - 20); createArrow(random(40) - 20); createArrow(random(40) - 20); } if (weaponUsed == 3) { createArrow(random(30) - 15); } if (weaponUsed == 4) { ar.Homing = true; } if (weaponUsed == 5) { shoot(char, true); } shotDelay = weaponSpeeds[weaponLevels[0][weaponUsed - 1]][weaponUsed - 1]; char.charIn.t.o.gotoAndPlay(2); char.charIn.t.o.wepTrails.r.gotoAndPlay(2); } if (ammos[weaponUsed - 1] <= 0 && weaponUsed != 1) { m = ammos.length - 1; while (m > 0) { if (ammos[m - 1] > 0 || m == 1) { useWeapon(m); break; } --m; } } } arrowMovement(); } function arrowMovement() { a = specArrows.length - 1; while (a >= 0) { specArrow = specArrows[a]; specArrow.arrowMC.removeMovieClip(); specArrow.arRealSpeed += 2; arrowMC = specArrow.createEmptyMovieClip('arrowMC' + depth++, 600556); specArrow.arrowMC = arrowMC; arrowMC.lineStyle(1, 16777215); arrowMC.moveTo(specArrow.startX + bg._x, specArrow.startY + bg._y); xmoveAdd = Math.cos(specArrow.rot * Math.PI / 180) * 30; ymoveAdd = Math.sin(specArrow.rot * Math.PI / 180) * 30; currentX = specArrow.startX + bg._x; currentY = specArrow.startY + bg._y; arLeft = false; arSpeed = -0.5; t = 0; while (t <= specArrow.tsIn) { if (t % 2 + specArrow.arRealSpeed == 0) { arLeft = !arLeft; } arSpeed = arLeft ? specArrow.arRealSpeed : -specArrow.arRealSpeed; arDir = (specArrow.rot + 90) * Math.PI / 180; currentX += xmoveAdd; currentY += ymoveAdd; arrowMC.lineTo(currentX + Math.cos(t / 5) * specArrow.arRealSpeed, currentY + Math.sin(t / 5) * specArrow.arRealSpeed); ++t; } specArrow._alpha -= 5; if (specArrow._alpha <= 0) { specArrow.removeMovieClip(); specArrows.splice(a, 1); } --a; } a = arrows.length - 1; while (a >= 0) { ar = arrows[a]; ar._x += ar.xSpeed; ar._y += ar.ySpeed; if (ar.Type == 2) { ar.xSpeed *= 0.9; ar.ySpeed *= 0.9; } if (ar.Type == 4) { ar.xSpeed *= 1.2; ar.ySpeed *= 1.2; } if (ar._x >= 0 && ar._x <= Stage.width && ar._y >= 0 && ar._y <= stageHeight) { if (random(3) == 0) { createParticles2(ar._x, ar._y, 1); } } if (ar.Homing) { closestEnemy = null; closestDist = 10000000; if (!ar.isGood) { closestEnemy = char; closestDist = hypot(ar, char); } e = enemies.length - 1; while (e >= 0) { enemy = enemies[e]; if (!enemy.isGood == ar.isGood || (gameMode == 2 || (gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)))) { if (hypot(ar, enemy) <= closestDist) { closestDist = hypot(ar, enemy); closestEnemy = enemy; } } --e; } if (closestEnemy != null && closestEnemy.onScreen) { tempRot = ar._rotation; qx2 = closestEnemy._x - ar._x; qy2 = closestEnemy._y - ar._y; radians = Math.atan2(qy2, qx2); tempTurn = radians * 180 / Math.PI; diffRot = (tempRot - tempTurn) % 360; if (diffRot > 180) { diffRot -= 360; } else { if (diffRot < -180) { diffRot += 360; } } if (Math.abs(diffRot) < 5) { tempRot = tempTurn; } else { if (diffRot < 0) { tempRot += 2.5; } else { tempRot -= 2.5; } } ar._rotation = tempRot; ar.xSpeed = Math.cos(ar._rotation * Math.PI / 180) * 40; ar.ySpeed = Math.sin(ar._rotation * Math.PI / 180) * 40; } } if (ar._x >= bg._x + bg.rb._width + ar._width / 2 || ar._y >= bg._y + bg.rb._height + ar._height / 2 || ar._x <= bg._x - ar._width / 2 || ar._y <= bg._y - ar._height / 2) { removeArrow(); } else { if (bgItems.fieldItems.hitTest(ar._x, ar._y, true)) { fs = attachMovie('floorShot', 'floorShot' + depth, depth++); fs._yscale = 200; fs._xscale = 200; fs._x = ar._x; fs._y = ar._y; fs._rotation = ar._rotation - 90; fs.gotoAndStop(random(3) + 1); floorShots.push(fs); if (ar.Homing) { ar._x -= ar.xSpeed; ar._y -= ar.ySpeed; ar._rotation = pointTheArrow(bgItems.fieldItems, ar, ar._rotation); ar.xSpeed = Math.cos(ar._rotation * Math.PI / 180) * 40; ar.ySpeed = Math.sin(ar._rotation * Math.PI / 180) * 40; } else { removeArrow(); } } else { if (ar.Type == 2) { ar._alpha -= 100.15 - ar._alpha; if (ar._alpha <= 0) { removeArrow(); } } } } --a; } a = arrows.length - 1; while (a >= 0) { ar = arrows[a]; hitEnemy = false; e = enemies.length - 1; while (e >= 0) { enemy = enemies[e]; if (enemy.charIn.enBody.hitTest(ar.center) && (!enemy.isGood == ar.isGood || (gameMode == 2 || (gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11))))) { enemy.charIn.gotoAndPlay(2); blood = attachMovie('blood', 'blood' + depth, depth++); blood.gotoAndStop(random(4) + 1); blood._x = enemy._x; blood._y = enemy._y; blood._rotation = ar._rotation; bloods.push(blood); if (ar.Homing) { if (random(5) == 1) { health += 25; if (health > healthMax) { health = healthMax; } char.hBar.inBar._xscale = (health / healthMax) * 100; } } if (ar.Type == 6 && !enemy.frozen) { enemy.iced.gotoAndStop(2); enemy.iced.inn.gotoAndPlay(1); enemy.frozen = true; enemy.frozenDelay = 60; } dmg = approx(ar.Damage + (Math.random() > criticalChance[skillLevels[2]] ? ar.Damage : 0)); enemy.health -= dmg; ahit.start(); damageStuff(enemy, dmg); enemy.lastAttacker = ar.ID; enemy.hBar.inBar._xscale = (enemy.health / enemy.healthMax) * 100; if (enemy.health <= 0) { if ((gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) && theSurvivor == enemy.ID) { theSurvivor = ar.ID; if (ar.ID == 0) { startInfo(18); char.gotoAndStop(2); } else { k = enemies.length - 1; while (k >= 0) { if (enemies[k].ID == ar.ID) { enemies[k].gotoAndStop(2); } --k; } } } shake = 1; explosion = attachMovie('explosion', 'explosion' + highDepth, highDepth++); explosion._x = enemy._x; explosion._y = enemy._y; er = explosion.attachMovie('enemyReward', 'enemyReward' + highDepth, highDepth++); er.r1.moneyTxt.htmlText = bold(enemyValue[level - 1]); money += enemyValue[level - 1]; enemyRewards.push(explosion); if (!gameDone) { if (enemy.isGood) { enemyKills += 1; } else { kills += 1; } if (ar.ID != 0) { enemyKillsAmt[ar.ID - 1] += 1; } else { if (ar.reflected) { giveAward(10); } playerKills += 1; bowKills[ar.Type - 1] += 1; totalKills += 1; testKills(); } enemyDeaths[enemy.ID - 1] += 1; } removeEnemy(); } removeArrow(); hitEnemy = true; e = -1; } --e; } if (!ar.isGood && !hitEnemy && char._alpha > 5 && ar._x != undefined) { if (char.charIn.abox.hitTest(ar.center)) { testAgainst(1); } } --a; } a = arrows.length - 1; while (a >= 0) { ar = arrows[a]; d = dragons.length - 1; while (d >= 0) { dragon = dragons[d]; if (dragon.dIn.hBox.hitTest(ar.center)) { shake = 1; dragon.gotoAndPlay((dragon.Type - 1) * 10 + 2); blood = attachMovie('blood', 'blood' + highDepth, highDepth++); blood.gotoAndStop(random(4) + 1); blood._x = dragon._x; blood._y = dragon._y; blood._rotation = ar._rotation; bloods.push(blood); if (ar.Homing) { if (random(5) == 1) { health += 25; if (health > healthMax) { health = healthMax; } char.hBar.inBar._xscale = (health / healthMax) * 100; } } dmg = approx(ar.Damage + (Math.random() > criticalChance[skillLevels[2]] ? ar.Damage : 0)); dragon.health -= dmg; ahit.start(); damageStuff(dragon, dmg); hud.bh.tBar._xscale = (dragon.health / dragon.healthMax) * 100; if (dragon.health <= 0) { hud.bh.tBar._xscale = 0; explosion = attachMovie('explosion', 'explosion' + highDepth, highDepth++); explosion._x = dragon._x; explosion._y = dragon._y; er = explosion.attachMovie('enemyReward', 'enemyReward' + highDepth, highDepth++); er.r1.moneyTxt.htmlText = bold(1000); enemyRewards.push(explosion); removeDragon(); } removeArrow(); } --d; } --a; } a = arrows.length - 1; while (a >= 0) { ar = arrows[a]; if (ar._x == undefined || ar.xSpeed == undefined || ar.xSpeed == NaN || ar.xSpeed == 0) { ar.removeMovieClip(); arrows.splice(a, 1); } --a; } b = bloods.length - 1; while (b >= 0) { blood = bloods[b]; if (blood.ina._currentframe == 39) { blood.removeMovieClip(); bloods.splice(b, 1); } --b; } e = enemyRewards.length - 1; while (e >= 0) { er = enemyRewards[e]; if (er._currentframe == 44) { er.removeMovieClip(); enemyRewards.splice(e, 1); } --e; } f = floorShots.length - 1; while (f >= 0) { fs = floorShots[f]; if (fs.f1._currentframe == 15) { fs.removeMovieClip(); floorShots.splice(f, 1); } --f; } } function testAgainst(hitType) { if (abilityOn && ability == 3) { if (hitType == 1) { ar._rotation += 180; ar._x -= ar.xSpeed; ar._y -= ar.ySpeed; ar.reflected = true; ar.isGood = true; ar.xSpeed *= -1; ar.ySpeed *= -1; } } else { if (char.respawnTime <= 0 && !isDead) { char.charIn.gotoAndPlay(2); blood = attachMovie('blood', 'blood' + depth, depth++); blood.gotoAndStop(random(4) + 1); blood._x = char._x; blood._y = char._y; if (hitType == 1) { blood._rotation = ar._rotation; if (ar.Type == 6 && !frozen) { char.iced.gotoAndStop(2); char.iced.inn.gotoAndPlay(1); frozen = true; frozenDelay = 60; } } else { if (hitType == 2) { blood._rotation = shooter._rotation; } else { if (hitType == 3) { blood._rotation = dragon._rotation; } else { blood._rotation = random(360); } } } bloods.push(blood); if (hitType == 1) { dmg = approx(ar.Damage); } else { if (hitType == 2) { dmg = approx(40 + (Math.random() > criticalChance[skillLevels[2]] ? 40 : 0)); } else { if (hitType == 3) { dmg = approx(20 + (Math.random() > criticalChance[skillLevels[2]] ? 20 : 0)); } else { if (hitType == 4) { dmg = random(5) + 1; } else { if (hitType == 5) { dmg = 20 + random(10); } else { if (hitType == 6) { dmg = 5 + random(5); } else { dmg = 1; } } } } } } health -= dmg; ahit.start(); damageStuff(char, dmg); char.hBar.inBar._xscale = (health / healthMax) * 100; if (health <= 0) { if (gameMode == 1 || gameMode == 6 && (teacherNum == 7 || teacherNum == 8)) { if (enemyFlagState == 2) { if (char.hasFlag) { startInfo(11); enemyFlagState = 3; enemyFlag = attachMovie('flag', 'flag' + highDepth, highDepth++); char.hasFlag = false; enemyFlag._x = char._x; enemyFlag._y = char._y; enemyFlag.f1.gotoAndStop(2); enemyFlag.isGood = false; flags.push(enemyFlag); char.flager.removeMovieClip(); } } } if ((gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) && theSurvivor == 0) { perfectSurvivor = false; if (hitType == 1) { theSurvivor = ar.ID; } else { if (hitType == 2) { theSurvivor = arrower.ID; } else { if (hitType == 5) { theSurvivor = exp.ID; } else { tHold = random(enemies.length); theSurvivor = enemies[tHold].ID; if (enemies.length == 0) { theSurvivor = 0; char.gotoAndStop(2); } } } } startInfo(12); char.gotoAndStop(1); if (hitType != 4) { k = enemies.length - 1; while (k >= 0) { if (enemies[k].ID == (hitType == 1) ? ar.ID : arrower.ID) { enemies[k].gotoAndStop(2); } --k; } } else { if (theSurvivor == 0) { char.gotoAndStop(2); } else { enemies[tHold].gotoAndStop(2); } } } if (!gameDone) { killWithoutDeath = 0; playerDeaths += 1; giveAward(11); if (hitType != 3 && hitType != 4) { if (hitType == 1) { enemyKillsAmt[ar.ID - 1] += 1; } else { if (hitType == 5) { enemyKillsAmt[exp.ID - 1] += 1; } else { enemyKillsAmt[arrower.ID - 1] += 1; } } enemyKills += 1; } } char.Shadow._alpha = 0; char.hBar._alpha = 0; theArrow._alpha = 0; rings._alpha = 0; char._alpha = 0; char.respawnTime = 90; if (gameMode == 5) { char.respawnTime = 200; } else { spawn = attachMovie('spawn', 'spawn' + higherDepth, higherDepth++); spawn._x = Stage.width / 2; spawn._y = Stage.height / 2; } } if (hitType == 1) { removeArrow(); } if (hitType == 7 || hitType == 6) { } } } } function findAngle(object, middlePointX, middlePointY, radius, degrees, stageIn, didHit) { if (stageIn == 10) { return degrees; } newPointX = middlePointX + Math.cos(degrees * Math.PI / 180) * radius; newPointY = middlePointY + Math.sin(degrees * Math.PI / 180) * radius; if (!didHit) { angle = findAngle(object, middlePointX, middlePointY, radius, degrees + -(180 / stageIn), stageIn + 1, object.hitTest(newPointX, newPointY, true)); return angle; } angle = findAngle(object, middlePointX, middlePointY, radius, degrees + 180 / stageIn, stageIn + 1, object.hitTest(newPointX, newPointY, true)); return angle; } function removeArrow() { if (ar._x != undefined) { if (ar.Type == 4) { createExplosion(ar.ID); } ar.removeMovieClip(); arrows.splice(a, 1); } } function createArrow(angle) { ar = attachMovie('arrow', 'arrow' + depth, depth++); ar.Damage = weaponPowers[weaponLevels[1][weaponUsed - 1]][weaponUsed - 1]; ar.gotoAndStop(weaponUsed); ar.Type = weaponUsed; ar._x = char._x; ar._y = char._y; ar.Homing = false; ar.ID = 0; ar.isGood = true; ar.hurtsFunEnemies = true; ar.reflected = false; ar._rotation = topRotation + angle; ar.xSpeed = Math.cos(ar._rotation * Math.PI / 180) * 40; ar.ySpeed = Math.sin(ar._rotation * Math.PI / 180) * 40; if (ar.Type == 2) { tAmt = Math.random() + 0.5; ar.xSpeed *= tAmt; ar.ySpeed *= tAmt; } if (ar.Type == 4) { tAmt = 0.1; ar.xSpeed *= tAmt; ar.ySpeed *= tAmt; } arrows.push(ar); } function createEnemyArrow(goodArrow, enemy, angle) { ar = attachMovie('arrow', 'arrow' + depth, depth++); ar.Damage = weaponStrengths[enemy.weaponUsed - 1]; ar.gotoAndStop(enemy.weaponUsed); ar.ID = enemy.ID; ar._x = enemy._x; ar._y = enemy._y; ar.Type = enemy.weaponUsed; ar.hurtsFunEnemies = true; ar.Homing = false; ar.reflected = false; ar.isGood = goodArrow; ar._rotation = enemy._rotation + angle; ar.xSpeed = Math.cos(ar._rotation * Math.PI / 180) * 40; ar.ySpeed = Math.sin(ar._rotation * Math.PI / 180) * 40; arrows.push(ar); } function createFunEnemyArrow(theShooter, angle, isGood) { if (theShooter == null) { ar = attachMovie('fireBall', 'fireBall' + depth, depth++); ar._x = -ar._width / 2; ar._y = angle; ar._rotation = 0; } else { ar = attachMovie('arrow', 'arrow' + depth, depth++); ar._x = theShooter._x; ar._y = theShooter._y; ar._rotation = theShooter._rotation + angle; } ar.Damage = 15 + random(15); ar.gotoAndStop(theShooter.enType); ar.hurtsFunEnemies = false; ar.ID = -1; ar.Type = 1; ar.Homing = false; ar.reflected = false; ar.isGood = isGood; ar.xSpeed = Math.cos(ar._rotation * Math.PI / 180) * 40; ar.ySpeed = Math.sin(ar._rotation * Math.PI / 180) * 40; if (theShooter == null) { ar.ySpeed = 0; ar.xSpeed = 10; } arrows.push(ar); } function setUpEnemyArrays() { enemyMax = enemiesPerLevel[level - 1] + alliesPerLevel[level - 1]; enemiesOnLevel = enemyMax; enemyKillsAmt = new Array(enemyMax); enemyDeaths = new Array(enemyMax); enemyScores = new Array(enemyMax); enemiesGood = new Array(enemyMax); enemiesAlive = new Array(enemyMax); d = 0; while (d < enemyMax) { enemyKillsAmt[d] = 0; enemyDeaths[d] = 0; enemyScores[d] = 0; enemiesGood[d] = d < alliesPerLevel[level - 1] ? true : false; enemiesAlive[d] = false; ++d; } } function createEnemy() { trackI = 0; toPick = new Array(); i = 0; while (i < enemiesAlive.length) { if (!enemiesAlive[i]) { toPick.push(i); } ++i; } trackI = toPick[random(toPick.length)]; if (gameMode == 6) { trackI = 0; } if (enemyNames[trackI] != undefined) { enemiesAlive[trackI] = true; enemy = attachMovie('char', 'enemy' + highDepth, highDepth++); enemy.rada = rada.empt.attachMovie('enemyRadar', 'enemyRadar' + depth, depth++); enemy.rada._x = 1000; enemy.Shadow = attachMovie('shadow', 'shadow' + depth, depth++); enemy.hBar = attachMovie('healthBar', 'hBar' + highDepth, highDepth++); enemy.ID = trackI + 1; enemy.lastAttacker = enemy.ID; enemy.Name = enemyNames[enemy.ID - 1]; enemy.hBar.nameTxt.htmlText = enemy.Name; changeArmor(enemy, enemy.ID + 1); enemy.accuracy = enemyAccuracies[level - 1]; enemy.shotDelay = 0; enemy.onScreen = false; enemy.charOnScreen = false; enemy.weaponUsed = 1; enemy.frozen = false; enemy.frozenDelay = 0; enemy.ammos = new Array(-1, 0, 0, 0, 0, 0); if (enemyStartingWeps[level - 1] != 1) { enemy.ammos[enemyStartingWeps[level - 1] - 1] += 30; enemyUseWeapon(enemyStartingWeps[level - 1]); } enemy.Speed = enemySpeeds[level - 1]; enemy.Speed2 = enemySpeeds2[level - 1]; enemy.Ability = enemyAbiltiies[level - 1]; if (gameMode == 1 || gameMode == 6 && (teacherNum == 7 || teacherNum == 8)) { enemy.hasFlag = false; } enemy.State = 1; enemy.newDir = 0; enemy.healthMax = enemyHealthMaxes[level - 1]; enemy.health = enemy.healthMax; if (gameMode == 6) { enemy.healthMax = 20; enemy.health = 20; } enemy._x = bgItems._x + appear._x; enemy._y = bgItems._y + appear._y; enemy.Shadow._x = enemy._x; enemy.Shadow._y = enemy._y; enemy.xSpeed = 0; enemy.ySpeed = 0; if (gameMode != 2 && gameMode != 3 && gameMode != 6) { if (enemiesGood[enemy.ID - 1]) { enemy.isGood = true; enemy.rada.gotoAndStop(2); enemy.hBar.inBar.gotoAndStop(1); enemy.hBar.backer.gotoAndStop(1); } else { enemy.isGood = false; enemy.hBar.inBar.gotoAndStop(2); enemy.hBar.backer.gotoAndStop(2); } } else { enemy.isGood = false; enemy.hBar.inBar.gotoAndStop(enemy.ID + 1); enemy.hBar.backer.gotoAndStop(enemy.ID + 1); } enemy.hBar._x = Math.floor(enemy._x); enemy.hBar._y = Math.floor(enemy._y) - 40; enemies.push(enemy); if (gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) { enemy.gotoAndStop(1); enemy.gotoAndStop(2); theSurvivor = enemy.ID; } } } function removeEnemy() { manageTeacher(11); manageTeacher(5); if (enemy.hasFlag) { flagState = 3; enemyFlag = attachMovie('flag', 'flag' + highDepth, highDepth++); enemy.hasFlag = false; enemyFlag._x = enemy._x; enemyFlag._y = enemy._y; enemyFlag.isGood = true; flags.push(enemyFlag); startInfo(15); enemy.flager.removeMovieClip(); } enemiesAlive[enemy.ID - 1] = false; enemy.rada.removeMovieClip(); enemy.hBar.removeMovieClip(); enemy.Shadow.removeMovieClip(); enemy.removeMovieClip(); enemies.splice(e, 1); } function removeEnemyB() { manageTeacher(11); manageTeacher(5); if (enemyB.hasFlag) { flagState = 3; enemyFlag = attachMovie('flag', 'flag' + highDepth, highDepth++); enemyB.hasFlag = false; enemyFlag._x = enemyB._x; enemyFlag._y = enemyB._y; enemyFlag.isGood = true; flags.push(enemyFlag); startInfo(15); enemyB.flager.removeMovieClip(); } enemiesAlive[enemyB.ID - 1] = false; enemyB.rada.removeMovieClip(); enemyB.hBar.removeMovieClip(); enemyB.Shadow.removeMovieClip(); enemyB.removeMovieClip(); enemies.splice(bb, 1); } function hypot(object1, object2) { return Math.sqrt((object1._x - object2._x) * (object1._x - object2._x) + (object1._y - object2._y) * (object1._y - object2._y)); } function createExplosion(theID) { exp = attachMovie('explosion', 'explosion' + depth, depth++); exp._x = ar._x; exp._y = ar._y; exp.ID = theID; explosions.push(exp); } function explosionManagement() { if (char.respawnTime > 0) { theArrow._alpha = 0; } a = explosions.length - 1; while (a >= 0) { exp = explosions[a]; if (exp.ina._currentframe == 1) { if (exp.hitBox.hitTest(char)) { testAgainst(5); } e = enemies.length - 1; while (e >= 0) { enemy = enemies[e]; if (exp.hitBox.hitTest(enemy)) { enemy.charIn.gotoAndPlay(2); blood = attachMovie('blood', 'blood' + depth, depth++); blood.gotoAndStop(random(4) + 1); blood._x = enemy._x; blood._y = enemy._y; blood._rotation = char._rotation; bloods.push(blood); dmg = 20 + random(10); if (exp.ID != enemy.ID) { enemy.lastAttacker = exp.ID; } enemy.health -= dmg; ahit.start(); damageStuff(enemy, dmg); enemy.hBar.inBar._xscale = (enemy.health / enemy.healthMax) * 100; if (enemy.health <= 0) { if (!gameDone) { if (exp.ID == enemy.ID) { exp.ID = enemy.lastAttacker; } if (enemy.isGood) { enemyKills += 1; } else { kills += 1; } if (exp.ID != 0) { enemyKillsAmt[exp.ID - 1] += 1; } else { playerKills += 1; bowKills[weaponUsed - 1] += 1; totalKills += 1; testKills(); } enemyDeaths[enemy.ID - 1] += 1; } if ((gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) && theSurvivor == enemy.ID) { enemy.gotoAndStop(1); tHold = random(enemies.length); enemies[tHold].gotoAndStop(2); theSurvivor = exp.ID; if (exp.ID == 0) { startInfo(18); char.gotoAndStop(2); } else { k = enemies.length - 1; while (k >= 0) { if (enemies[k].ID == exp.ID) { enemies[k].gotoAndStop(2); } --k; } } } shake = 1; removeEnemy(); } } --e; } } --a; } } function removeExplosion() { exp.removeMovieClip(); explosions.splice(a, 1); } function enemyManagement() { enemyDelay -= 1; if (enemyDelay <= 0 && enemies.length + appears.length < enemyMax && gameMode != 5 && gameMode != 6 || enemyDelay <= 0 && gameMode == 6 && enemies.length == 0 && !enCreated && teacherNum == 4 || enemyDelay <= 0 && gameMode == 6 && !enCreated2 && teacherNum == 10) { if (gameMode != 5) { enCreated = true; if (teacherNum == 10) { enCreated2 = true; } enemyDelay = enemyDelayConst; ap = bgItems.attachMovie('appear', 'appear' + depth, depth++); portalSelected = random(enemyPortals.length) + 1; if (gameMode == 1 || gameMode == 6 && (teacherNum == 7 || teacherNum == 8 || teacherNum == 10)) { trackI = 0; i = 0; while (i < enemiesAlive.length) { if (!enemiesAlive[i]) { trackI = i; break; } ++i; } ID = trackI + 1; if (enemiesGood[ID - 1]) { tempHolder = random(goodPortals.length + nuetralPortals.length); portalSelected = tempHolder >= goodPortals.length ? nuetralPortals[tempHolder - goodPortals.length] : goodPortals[tempHolder]; } else { tempHolder = random(badPortals.length + nuetralPortals.length); portalSelected = tempHolder >= badPortals.length ? nuetralPortals[tempHolder - badPortals.length] : badPortals[tempHolder]; } } ap._x = enemyPortals[portalSelected - 1]._x; ap._y = enemyPortals[portalSelected - 1]._y; if (gameMode == 6) { if (char._x <= Stage.width / 2) { ap._x = char._x + 200 - bgItems._x; } else { ap._x = char._x - 200 - bgItems._y; } ap._y = char._y - bgItems._y; } appears.push(ap); } } e = enemies.length - 1; while (e >= 0) { enemy = enemies[e]; rotter = enemy._rotation; if (theSurvivor == enemy.ID && enemy._currentframe != 2) { enemy.gotoAndStop(2); } if (enemy._currentframe != 1 && enemy.ID != theSurvivor) { enemy.gotoAndStop(1); } closestFoe = null; closestDist = 0; if (gameMode != 2 && gameMode != 3) { if (!enemy.isGood) { closestFoe = null; closestDist = 9999999; if (abilityOn && ability == 1 || char.respawnTime > 0) { } else { closestFoe = char; closestDist = hypot(char, enemy); } k = enemies.length - 1; while (k >= 0) { if (enemies[k].isGood && hypot(enemies[k], enemy) <= closestDist) { closestDist = hypot(enemies[k], enemy); closestFoe = enemies[k]; } --k; } } else { closestDist = 9999999; k = enemies.length - 1; while (k >= 0) { if (!enemies[k].isGood && hypot(enemies[k], enemy) <= closestDist) { closestDist = hypot(enemies[k], enemy); closestFoe = enemies[k]; } --k; } } } else { closestFoe = null; closestDist = 9999999; if (abilityOn && ability == 1 || char.respawnTime > 0) { } else { closestFoe = char; closestDist = hypot(char, enemy); } k = enemies.length - 1; while (k >= 0) { if (enemies[k] != enemy && hypot(enemies[k], enemy) <= closestDist) { closestDist = hypot(enemies[k], enemy); closestFoe = enemies[k]; } --k; } } enDir = Math.atan2(closestFoe._y - enemy._y, closestFoe._x - enemy._x); enemy.newDir -= 1; if (enemy.newDir <= 0 && enemy.State == 2) { enemy.newDir = 30 + random(150); dir = Math.PI * Math.random() * 2; enemy.xSpeed = Math.cos(dir) * enemy.Speed2; enemy.ySpeed = Math.sin(dir) * enemy.Speed2; enemy._rotation = dir * 180 / Math.PI; g = genSpots.length - 1; while (g >= 0) { genSpot = genSpots[g]; dister = Math.sqrt((bg._x + genSpot._x - enemy._x) * (bg._x + genSpot._x - enemy._x) + (bg._y + genSpot._y - enemy._y) * (bg._y + genSpot._y - enemy._y)); if (dister <= 300) { dir = Math.atan2(bg._y + genSpot._y - enemy._y, bg._x + genSpot._x - enemy._x); enemy.xSpeed = Math.cos(dir) * enemy.Speed2; enemy.ySpeed = Math.sin(dir) * enemy.Speed2; enemy._rotation = dir * 180 / Math.PI; } --g; } } if ((gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) && enemy.State == 2) { if (theSurvivor != enemy.ID) { theTarget = null; if (theSurvivor == 0) { if (abilityOn && ability == 1) { } else { theTarget = char; } } else { k = enemies.length - 1; while (k >= 0) { if (theSurvivor == enemies[k].ID) { theTarget = enemies[k]; } --k; } } if (theTarget != null) { dir = Math.atan2(theTarget._y - enemy._y, theTarget._x - enemy._x); enemy.xSpeed = Math.cos(dir) * enemy.Speed2; enemy.ySpeed = Math.sin(dir) * enemy.Speed2; enemy._rotation = dir * 180 / Math.PI; } else { enemy.State = 1; } } } if (enemy.State == 1 || enemy.State == 3) { enemy._rotation = enDir * 180 / Math.PI; } else { if (enemy.State == 2) { } } if (enemy.newDir <= 0 && (enemy.State == 1 || enemy.State == 3)) { enemy.newDir = 10 + random(20); closestFoeDir = Math.atan2(ySpeed, xSpeed); closestFoeNewX = closestFoe._x + Math.cos(closestFoeDir) * enemy.Speed2 * (enemy.newDir / 2); closestFoeNewY = closestFoe._y + Math.sin(closestFoeDir) * enemy.Speed2 * (enemy.newDir / 2); spot1X = closestFoeNewX + Math.cos(closestFoeDir + 1.570796326794897) * enemy.Speed2 * (enemy.newDir / 2); spot1Y = closestFoeNewY + Math.sin(closestFoeDir + 1.570796326794897) * enemy.Speed2 * (enemy.newDir / 2); spot2X = closestFoeNewX + Math.cos(closestFoeDir - 1.570796326794897) * enemy.Speed2 * (enemy.newDir / 2); spot2Y = closestFoeNewY + Math.sin(closestFoeDir - 1.570796326794897) * enemy.Speed2 * (enemy.newDir / 2); d1 = calcDist(enemy._x, enemy._y, Math.atan2(spot1Y - closestFoeNewY, spot1X - closestFoeNewX), closestFoeNewX, closestFoeNewY, enemy.newDir); d2 = calcDist(enemy._x, enemy._y, Math.atan2(spot2Y - closestFoeNewY, spot2X - closestFoeNewX), closestFoeNewX, closestFoeNewY, enemy.newDir); lowest = d1 < d2 ? 1 : 2; if (d1 <= 150) { lowest = 2; } if (d2 <= 150) { lowest = 1; } if (lowest == 1 && d1 >= 150) { enemy.xSpeed = Math.cos(Math.atan2(spot1Y - closestFoeNewY, spot1X - closestFoeNewX)) * enemy.Speed2; enemy.ySpeed = Math.sin(Math.atan2(spot1Y - closestFoeNewY, spot1X - closestFoeNewX)) * enemy.Speed2; } else { if (lowest == 2 && d2 >= 150) { enemy.xSpeed = Math.cos(Math.atan2(spot2Y - closestFoeNewY, spot2X - closestFoeNewX)) * enemy.Speed2; enemy.ySpeed = Math.sin(Math.atan2(spot2Y - closestFoeNewY, spot2X - closestFoeNewX)) * enemy.Speed2; } else { enemy.xSpeed = Math.cos(Math.atan2(enemy._y - closestFoe._y, enemy._x - closestFoe._x)) * enemy.Speed2; enemy.ySpeed = Math.cos(Math.atan2(enemy._y - closestFoe._y, enemy._x - closestFoe._x)) * enemy.Speed2; } } } if (gameMode == 1 || gameMode == 6 && (teacherNum == 7 || teacherNum == 8)) { if (enemy.hasFlag) { enemy.flager._x = enemy._x; enemy.flager._y = enemy._y - 60; } if (!enemy.isGood) { if (flagState == 1 && enemy.State == 2) { dir = Math.atan2(bgItems._y + bgItems.f1._y - enemy._y, bgItems._x + bgItems.f1._x - enemy._x); enemy.xSpeed = Math.cos(dir) * enemy.Speed2; enemy.ySpeed = Math.sin(dir) * enemy.Speed2; if (enemy.hitTest(bgItems.f1)) { bgItems.f1._alpha = 0; enemy.flager = attachMovie('flag', 'flag' + highDepth, highDepth++); enemy.hasFlag = true; flagState = 2; startInfo(13); } } if (flagState == 3 || enemyFlagState == 3) { targetFlag = null; f = flags.length - 1; while (f >= 0) { flag = flags[f]; if (flags[f].isGood) { targetFlag = flags[f]; dir = Math.atan2(targetFlag._x - enemy._y, targetFlag._x - enemy._x); enemy.xSpeed = Math.cos(dir) * enemy.Speed2; enemy.ySpeed = Math.sin(dir) * enemy.Speed2; if (enemy.hitTest(targetFlag)) { targetFlag.removeMovieClip(); flags.splice(f, 1); startInfo(17); enemy.flager = attachMovie('flag', 'flag' + highDepth, highDepth++); enemy.hasFlag = true; flagState = 2; } else { if (char.hitTest(targetFlag)) { targetFlag.removeMovieClip(); flags.splice(f, 1); startInfo(10); bgItems.f1._alpha = 100; flagState = 1; } } } else { if (!enemy.isGood) { if (hypot(enemy, flags[f]) <= 300) { dir = Math.atan2(flags[f]._y - enemy._y, flags[f]._x - enemy._x); enemy.xSpeed = Math.cos(dir) * enemy.Speed2; enemy.ySpeed = Math.sin(dir) * enemy.Speed2; if (enemy.hitTest(flags[f])) { removeFlag(); startInfo(16); bgItems.f2._alpha = 100; enemyFlagState = 1; } } } } --f; } } if (enemy.hasFlag) { dir = Math.atan2(bgItems._y + bgItems.f2._y - enemy._y, bgItems._x + bgItems.f2._x - enemy._x); enemy.xSpeed = Math.cos(dir) * enemy.Speed2; enemy.ySpeed = Math.sin(dir) * enemy.Speed2; if (enemy.State == 2) { enemy._rotation = dir * 180 / Math.PI; } if (enemy.hitTest(bgItems.f2)) { flagState = 1; startInfo(14); enemy.flager.removeMovieClip(); enemy.hasFlag = false; bgItems.f1._alpha = 100; if (!gameDone) { enemyScores[enemy.ID - 1] += 1; enemyPoints += 1; } } } } } if ((gameMode == 4 || gameMode == 6 && teacherNum == 13) && enemy.State == 2) { closestPortal = null; closestPortalDist = 9999999999.0; t = territories.length - 1; while (t >= 0) { territory = territories[t]; trueDist = Math.sqrt((bgItems._x + territory._x - enemy._x) * (bgItems._x + territory._x - enemy._x) + (bgItems._y + territory._y - enemy._y) * (bgItems._y + territory._y - enemy._y)); if (trueDist <= cloestPortalDist) { if (enemy.isGood && territory._currentframe > 2 || !enemy.isGood && territory._currentframe < 89) { closestPortalDist = trueDist; closestPortal = territory; } } --t; } closestPortal = findClosestTerritory(enemy, enemy.isGood); trueDist = Math.sqrt((bgItems._x + closestPortal._x - enemy._x) * (bgItems._x + closestPortal._x - enemy._x) + (bgItems._y + closestPortal._y - enemy._y) * (bgItems._y + closestPortal._y - enemy._y)); dir = Math.atan2(bgItems._y + closestPortal._y - enemy._y, bgItems._x + closestPortal._x - enemy._x); enemy.xSpeed = Math.cos(dir) * enemy.Speed2; enemy.ySpeed = Math.sin(dir) * enemy.Speed2; if (trueDist <= 20) { enemy.xSpeed = 0; enemy.ySpeed = 0; } } if (enemy.frozen) { enemy._rotation = rotter; enemy.frozenDelay -= 1; if (enemy.frozenDelay <= 0) { enemy.frozen = false; enemy.newDir = 0; enemy.State = 2; } else { enemy.xSpeed = 0; enemy.ySpeed = 0; } } enemy._x += enemy.xSpeed * enemy.Speed; enemy._y += enemy.ySpeed * enemy.Speed; enemy.rada._x = (enemy._x - char._x) / 20; enemy.rada._y = (enemy._y - char._y) / 20; if (bgItems.fieldItems4.hitTest(enemy._x, enemy._y, true)) { enemy._x += enemy.xSpeed * 1; enemy._y += enemy.ySpeed * 1; } if (bgItems.fieldItems2.hitTest(enemy._x, enemy._y, true)) { enemy._x -= enemy.xSpeed * 0.75; enemy._y -= enemy.ySpeed * 0.75; } if (bgItems.fieldItems5.hitTest(enemy._x, enemy._y, true)) { enemy.charIn.gotoAndPlay(2); blood = attachMovie('blood', 'blood' + depth, depth++); blood.gotoAndStop(random(4) + 1); blood._x = enemy._x; blood._y = enemy._y; blood._rotation = char._rotation; bloods.push(blood); dmg = random(5) + 1; enemy.health -= dmg; ahit.start(); damageStuff(enemy, dmg); enemy.hBar.inBar._xscale = (enemy.health / enemy.healthMax) * 100; if (enemy.health <= 0) { if ((gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) && theSurvivor == enemy.ID) { enemy.gotoAndStop(1); tHold = random(enemies.length); enemies[tHold].gotoAndStop(2); theSurvivor = enemies[tHold].ID; if (enemies.length == 0) { theSurvivor = 0; char.gotoAndStop(2); } } shake = 1; explosion = attachMovie('explosion', 'explosion' + highDepth, highDepth++); explosion._x = enemy._x; explosion._y = enemy._y; enemyRewards.push(explosion); removeEnemy(); } xSpeed *= 0.6; ySpeed *= 0.6; } if (enemy._x != undefined) { enemy.onScreen = false; if (Math.abs(closestFoe._x - enemy._x) <= Stage.width / 2 && Math.abs(closestFoe._y - enemy._y) <= stageHeight / 2) { enemy.onScreen = true; } enemy.charOnScreen = false; if (enemy._x >= 0 && enemy._x <= Stage.width && enemy._y >= 0 && enemy._y <= stageHeight) { enemy.charOnScreen = true; } if (!enemy.onScreen || closestFoe == null) { enemy.State = 2; } else { hitWall = false; eDist = hypot(enemy, closestFoe); eDir = Math.atan2(closestFoe._y - enemy._y, closestFoe._x - enemy._x); pointX = enemy._x; pointY = enemy._y; l = 0; while (l < 20) { pointX += Math.cos(eDir) * (eDist / 20); pointY += Math.sin(eDir) * (eDist / 20); if (bgItems.fieldItems.hitTest(pointX, pointY, true)) { hitWall = true; break; } ++l; } if (bgItems.fieldItems.hitTest(en._x + 10, en._y, true) || bgItems.fieldItems3.hitTest(en._x + 10, en._y, true)) { hitWall = true; } if (bgItems.fieldItems.hitTest(en._x - 10, en._y, true) || bgItems.fieldItems3.hitTest(en._x - 10, en._y, true)) { hitWall = true; } if (bgItems.fieldItems.hitTest(en._x, en._y + 10, true) || bgItems.fieldItems3.hitTest(en._x, en._y + 10, true)) { hitWall = true; } if (bgItems.fieldItems.hitTest(en._x, en._y - 10, true) || bgItems.fieldItems3.hitTest(en._x, en._y - 10, true)) { hitWall = true; } if (hitWall) { enemy.State = 2; } else { if (enemy.health > 1) { enemy.State = 1; } else { enemy.State = 3; } } } enemy.shotDelay -= 1; if (enemy.shotDelay <= 0 && (!isDead || closestFoe != char) && closestFoe != null && enemy.onScreen && enemy.State != 2 && !enemy.frozen) { enemy.ammos[enemy.weaponUsed - 1] -= 1; enemy.shotDelay = weaponSpeeds[enLevels[level - 1]][enemy.weaponUsed - 1]; theAng = Math.random() * enemy.accuracy - enemy.accuracy / 2; if (enemy.weaponUsed != 2 && enemy.weaponUsed != 3 && enemy.weaponUsed != 5) { createEnemyArrow(enemy.isGood, enemy, theAng); } if (enemy.weaponUsed == 2) { createEnemyArrow(enemy.isGood, enemy, theAng + random(40) - 20); createEnemyArrow(enemy.isGood, enemy, theAng + random(40) - 20); createEnemyArrow(enemy.isGood, enemy, theAng + random(40) - 20); createEnemyArrow(enemy.isGood, enemy, theAng + random(40) - 20); createEnemyArrow(enemy.isGood, enemy, theAng + random(40) - 20); } if (enemy.weaponUsed == 3) { createEnemyArrow(enemy.isGood, enemy, theAng + random(30) - 15); } if (enemy.weaponUsed == 4) { ar.Homing = true; } if (enemy.weaponUsed == 5) { shoot(enemy, enemy.isGood); } enemy._rotation = enDir * 180 / Math.PI; enemy.charIn.t.o.gotoAndPlay(2); } if (enemy.ammos[enemy.weaponUsed - 1] <= 0 && enemy.weaponUsed != 1) { m = enemy.ammos.length - 1; while (m > 0) { if (enemy.ammos[m - 1] > 0 || m == 1) { enemyUseWeapon(m); break; } --m; } } for (;;) { if (!(bgItems.fieldItems.hitTest(enemy._x + 10, enemy._y, true) || bgItems.fieldItems3.hitTest(enemy._x + 10, enemy._y, true))) break; enemy._x -= 0.5; } for (;;) { if (!(bgItems.fieldItems.hitTest(enemy._x - 10, enemy._y, true) || bgItems.fieldItems3.hitTest(enemy._x - 10, enemy._y, true))) break; enemy._x += 0.5; } for (;;) { if (!(bgItems.fieldItems.hitTest(enemy._x, enemy._y + 10, true) || bgItems.fieldItems3.hitTest(enemy._x, enemy._y + 10, true))) break; enemy._y -= 0.5; } for (;;) { if (!(bgItems.fieldItems.hitTest(enemy._x, enemy._y - 10, true) || bgItems.fieldItems3.hitTest(enemy._x, enemy._y - 10, true))) break; enemy._y += 0.5; } if (enemy._x >= bg._x + bg.rb._width - 10) { enemy._x = bg._x + bg.rb._width - 10; if (enemy.State == 2) { enemy.newDir = 0; } } if (enemy._y >= bg._y + bg.rb._height - 10) { enemy._y = bg._y + bg.rb._height - 10; if (enemy.State == 2) { enemy.newDir = 0; } } if (enemy._x <= bg._x + 10) { enemy._x = bg._x + 10; if (enemy.State == 2) { enemy.newDir = 0; } } if (enemy._y <= bg._y + 10) { enemy._y = bg._y + 10; if (enemy.State == 2) { enemy.newDir = 0; } } enemy.Shadow._x = enemy._x; enemy.Shadow._y = enemy._y; enemy.hBar._x = Math.floor(enemy._x); enemy.hBar._y = Math.floor(enemy._y) - 40; } if (enemy._x == undefined) { removeEnemy(); } --e; } a = appears.length - 1; while (a >= 0) { appear = appears[a]; if (appear._currentframe == 30) { createParticles(20, appear); createEnemy(); appear.removeMovieClip(); appears.splice(a, 1); } --a; } } function calcDist(origX, origY, rot, targetX, targetY, frames) { newX = origX + Math.cos(rot) * speed * frames; newY = origY + Math.sin(rot) * speed * frames; dist = Math.sqrt((newX - targetX) * (newX - targetX) + (newY - targetY) * (newY - targetY)); return dist; } function formatNumber(number) { var v1 = number.toString(); var v3 = ''; while (v1.length > 3) { var v2 = v1.substr(-3); v1 = v1.substr(0, v1.length - 3); v3 = ',' + v2 + v3; } if (v1.length > 0) { v3 = v1 + v3; } return v3; } function createShop() { shop = attachMovie('shop', 'shop', 953500); shop._x = Stage.width / 2; shop._y = Stage.height / 2; inShop = true; bg._x = -(bg.rb._width - Stage.width) / 2; bg._y = -(bg.rb._height - Stage.height) / 2; shop.moneyTxt.htmlText = bold('$' + formatNumber(money)); shop.nameTxt.htmlText = bold(yourName); if (ability == 0) { shop.abilityTxt.htmlText = bold('None'); } else { shop.abilityTxt.htmlText = bold(abilityNames[ability - 1]); } if (startingWep == 1) { shop.bowNameTxt.htmlText = bold('No Weapon'); } else { shop.bowNameTxt.htmlText = bold(weaponNames[startingWep - 2]); } shop.char.charIn.t.o.bow.gotoAndStop(startingWep); shop.char.charIn.t.o.arrow.gotoAndStop(startingWep); shop.mLTxt.htmlText = bold('Level ' + (level + 1) + '/25'); shop.mTTxt.htmlText = modeNames[gameModes[level]]; shop.mMTxt.htmlText = bold(mapNames[mapOrder[level] - 1]); shop.mD.sBalls = new Array(shop.mD.s1, shop.mD.s2, shop.mD.s3, shop.mD.s4, shop.mD.s5, shop.mD.s6, shop.mD.s7, shop.mD.s8, shop.mD.s9, shop.mD.s10); s = 0; while (s < levelDifficulties[level]) { shop.mD.sBalls[s].gotoAndStop(2); ++s; } shop.nextLevel.onRollOver = function () { shop.nextLevel.b1.gotoAndStop(2); }; shop.nextLevel.onRollOut = function () { shop.nextLevel.b1.gotoAndStop(1); }; shop.nextLevel.onReleaseOutside = function () { shop.nextLevel.b1.gotoAndStop(1); }; shop.nextLevel.onRelease = function () { lSelected = levelsUnlocked; shop.removeMovieClip(); ls = attachMovie('levelSelectScreen', 'levelSelectScreen', 953510); ls._x = Stage.width / 2; ls._y = Stage.height / 2; lsButtons = new Array(ls.a1, ls.a2, ls.a3, ls.a4, ls.a5, ls.a6, ls.a7, ls.a8, ls.a9, ls.a10, ls.a11, ls.a12, ls.a13, ls.a14, ls.a15, ls.a16, ls.a17, ls.a18, ls.a19, ls.a20, ls.a21, ls.a22); l = 0; while (l < levelsUnlocked) { lB = lsButtons[l]; lB.gotoAndStop(2); if (l == levelsUnlocked - 1) { lB.c1._alpha = 0; } createLSButton(lB, l); ++l; } createGenHover(ls.b1); ls.b1.onRelease = function () { ls.removeMovieClip(); createShop(); }; createGenHover(ls.p1); ls.p1.onRelease = function () { ls.removeMovieClip(); hasReleased = false; dragonKilled = false; im.removeMovieClip(); ib.removeMovieClip(); it2.removeMovieClip(); im2.removeMovieClip(); ib2.removeMovieClip(); rada._alpha = 100; inShop = false; char.gotoAndStop(1); speed = speeds[skillLevels[0]]; healthMax = healthMaxes[skillLevels[1]]; bg._x = -(bg.rb._width - Stage.width) / 2; bg._y = -(bg.rb._height - Stage.height) / 2; bgItems._x = bg._x; bgItems._y = bg._y; char._x = Stage.width / 2; char._y = stageHeight / 2; char.hBar._alpha = 100; statInfo._x = -1000; health = healthMax; char.hBar.inBar._xscale = 100; e = enemies.length - 1; while (e >= 0) { enemy = enemies[e]; removeEnemy(); --e; } f = flags.length - 1; while (f >= 0) { flag = flags[f]; removeFlag(); --f; } playerKills = 0; playerDeaths = 0; playerScore = 0; char._alpha = 100; char.respawnTime = 0; isDead = false; bgItems.t1.gotoAndStop(45); bgItems.t2.gotoAndStop(45); bgItems.t3.gotoAndStop(45); perfectSurvivor = true; killsWithoutDeath = 0; killStreak = 0; points = 0; enemyPoints = 0; char.hasFlag = false; bgItems.f2.f1.gotoAndStop(2); flagState = 1; enemyFlagState = 1; foundDelay = 0; hasReleased = false; ammos = new Array(-1, 0, 0, 0, 0, 0); useWeapon(startingWep); ammos[weaponUsed - 1] = weaponAmmos[weaponLevels[2][weaponUsed - 1]][weaponUsed - 1]; manageAmmo(); changeArmor(char, ability + 1); kills = 0; enemyKills = 0; gameDone = false; gamePause = true; clearScreen(); level = lSelected; setUpEnemyArrays(); char.Shadow._x = char._x; char.Shadow._y = char._y; char.hBar._x = char._x; char.hBar._y = char._y - 40; theArrow._x = char._x; theArrow._y = char._y; rings._x = char._x; rings._y = char._y; countDown = attachMovie('countDown', 'countDown', 851550); countDown._x = Stage.width / 2; countDown._y = stageHeight / 2; counting = true; gameStarted = false; startGens(); saveGame(); enemies = new Array(); selectLevel(levelBgs[level - 1]); bg.gotoAndStop(mapOrder[level - 1]); gameMode = gameModes[level - 1]; manageModes(); }; }; shopAbilityInfo[ability - 1].e1._alpha = 100; changeArmor(shop.char, ability + 1); shopSkillLefts = new Array(shop.d1, shop.d2, shop.d3); shopAbilityInfo = new Array(shop.aa1, shop.aa2, shop.aa3); shopSkillInfo = new Array(shop.ss1, shop.ss2, shop.ss3); shopWeaponInfo = new Array(shop.ww1, shop.ww2, shop.ww3, shop.ww4, shop.ww5); shopAbilityButtons = new Array(shop.a1, shop.a2, shop.a3); shopSkillButtons = new Array(shop.s1, shop.s2, shop.s3); shopWeaponButtons = new Array(shop.w1, shop.w2, shop.w3, shop.w4, shop.w5); shopWeaponUpgrades = new Array(shop.q1, shop.q2, shop.q3); if (startingWep != 1) { shopWeaponInfo[startingWep - 2].e1._alpha = 100; } if (ability != 0) { shopAbilityInfo[ability - 1].e1._alpha = 100; } a = shopAbilityButtons.length - 1; while (a >= 0) { shopAbilityButtons[a].bowImg.gotoAndStop(a + 7); shopAbilityInfo[a].descTxt.htmlText = abilityDescriptions[a]; shopAbilityInfo[a].infoer.nameTxt.htmlText = abilityNames[a]; shopAbilityInfo[a].infoer.costTxt.htmlText = '$' + formatNumber(abilityCosts[a]); createShopOverButton(shopAbilityButtons[a], shopAbilityInfo[a]); createAbilityBuy(shopAbilityButtons[a], a); --a; } a = shopSkillButtons.length - 1; while (a >= 0) { shopSkillButtons[a].bowImg.gotoAndStop(a + 10); createShopOverButton(shopSkillButtons[a], shopSkillInfo[a]); createSkillBuy(shopSkillButtons[a], a); --a; } a = shopWeaponButtons.length - 1; while (a >= 0) { shopWeaponButtons[a].bowImg.gotoAndStop(a + 2); shopWeaponInfo[a].descTxt.htmlText = weaponDescriptions[a]; shopWeaponInfo[a].infoer.nameTxt.htmlText = weaponNames[a]; shopWeaponInfo[a].infoer.costTxt.htmlText = '$' + formatNumber(weaponCosts[a]); createShopOverButton(shopWeaponButtons[a], shopWeaponInfo[a]); createWeaponBuy(shopWeaponButtons[a], a); --a; } createShopWeaponUpgrades(startingWep - 1); } function createLSButton(button, num) { button.aTxt.htmlText = levelNames[num]; button.onRollOver = function () { if (button.ba._currentframe != 3) { button.ba.gotoAndStop(2); } }; button.onRollOut = function () { if (button.ba._currentframe != 3) { button.ba.gotoAndStop(1); } }; button.onReleaseOutside = function () { if (button.ba._currentframe != 3) { button.ba.gotoAndStop(1); } }; button.onRelease = function () { l = 0; while (l < lsButtons.length) { lB = lsButtons[l]; lB.ba.gotoAndStop(1); ++l; } lSelected = num + 1; button.ba.gotoAndStop(3); }; } function createGenHover(button) { button.onRollOver = function () { button.gotoAndStop(2); }; button.onRollOut = function () { button.gotoAndStop(1); }; button.onReleaseOutside = function () { button.gotoAndStop(1); }; } function createShopWeaponUpgrades(bow) { if (bow == 0) { a = shopWeaponUpgrades.length - 1; while (a >= 0) { shopWeaponUpgrades[a]._alpha = 0; --a; } } else { a = shopWeaponUpgrades.length - 1; while (a >= 0) { shopWeaponUpgrades[a]._alpha = 100; createShopWeaponUpgradeButton(shopWeaponUpgrades[a], a, bow); --a; } } } function createShopWeaponUpgradeButton(button, num, bow) { createGenHover(button.b1); button.n1.htmlText = weaponUpgradeNames[num]; button.c1.htmlText = '$' + weaponUpgradeCosts[num][bow][weaponLevels[num][bow]]; button.u1.htmlText = bold(weaponStats[num][weaponLevels[num][bow]][bow] + ' to ' + weaponStats[num][weaponLevels[num][bow] + 1][bow]); if (weaponLevels[num][bow] == 3) { button.u1.htmlText = bold(weaponStats[num][weaponLevels[num][bow]][bow] + ' to Maxed'); button.c1.htmlText = '$Maxed'; } if (num == 0) { button.u1.htmlText = bold(35 - weaponStats[num][weaponLevels[num][bow]][bow] + ' to ' + (35 - weaponStats[num][weaponLevels[num][bow] + 1][bow])); if (weaponLevels[num][bow] == 3) { button.u1.htmlText = bold(35 - weaponStats[num][weaponLevels[num][bow]][bow] + ' to Maxed'); } } button.s1.inArray = new Array(button.s1.s1, button.s1.s2, button.s1.s3); k = 0; while (k < weaponLevels[num][bow]) { button.s1.inArray[k].gotoAndStop(2); ++k; } k = weaponLevels[num][bow]; while (k < button.s1.inArray.length) { button.s1.inArray[k].gotoAndStop(1); ++k; } button.b1.onRelease = function () { if (money >= weaponUpgradeCosts[num][bow][weaponLevels[num][bow]] && weaponLevels[num][bow] != 3) { money -= weaponUpgradeCosts[num][bow][weaponLevels[num][bow]]; weaponLevels[num][bow] += 1; createShopWeaponUpgradeButton(button, num, bow); shop.moneyTxt.htmlText = bold('$' + formatNumber(money)); } }; } function createAbilityBuy(button, num) { if (money < abilityCosts[num] && !abilitiesOwned[num]) { shopAbilityButtons[num].l1._alpha = 100; shopAbilityButtons[num].bowImg.gotoAndStop(1); } else { shopAbilityButtons[num].l1._alpha = 0; shopAbilityButtons[num].bowImg.t1.gotoAndStop(abilitiesOwned[num] ? 2 : 1); } button.onRelease = function () { if (money >= abilityCosts[num] && !abilitiesOwned[num]) { abilitiesOwned[num] = true; money -= abilityCosts[num]; c = shopWeaponButtons.length - 1; while (c >= 0) { createWeaponBuy(shopWeaponButtons[c], c); --c; } c = shopAbilityButtons.length - 1; while (c >= 0) { createAbilityBuy(shopAbilityButtons[c], c); --c; } c = shopSkillButtons.length - 1; while (c >= 0) { createSkillBuy(shopSkillButtons[c], c); --c; } ability = num + 1; shopAbilityButtons[num].bowImg.t1.gotoAndStop(2); shop.moneyTxt.htmlText = bold('$' + formatNumber(money)); t = 0; while (t < 3) { shopAbilityInfo[t].e1._alpha = 0; ++t; } shopAbilityInfo[num].e1._alpha = 100; changeArmor(shop.char, num + 2); shop.abilityTxt.htmlText = bold(abilityNames[num]); } if (abilitiesOwned[num]) { t = 0; while (t < 3) { shopAbilityInfo[t].e1._alpha = 0; ++t; } ability = num + 1; shopAbilityInfo[num].e1._alpha = 100; changeArmor(shop.char, num + 2); shop.abilityTxt.htmlText = bold(abilityNames[num]); } }; } function createSkillBuy(button, num) { shopSkillInfo[num].infoer.nameTxt.htmlText = skillNames[num]; shopSkillInfo[num].infoer.costTxt.htmlText = '$' + formatNumber(skillCosts[num][skillLevels[num]]); shopSkillInfo[num].descTxt.htmlText = skillDescs[num]; shopSkillLefts[num].dotArrays = new Array(shopSkillLefts[num].s1, shopSkillLefts[num].s2, shopSkillLefts[num].s3, shopSkillLefts[num].s4); tArray = new Array(button.bowImg.v1, button.bowImg.v2, button.bowImg.v3, button.bowImg.v4); s = 0; while (s < skillLevels[num]) { tArray[s].gotoAndStop(2); shopSkillInfo[num].dotArray[s].gotoAndStop(2); shopSkillLefts[num].dotArrays[s].gotoAndStop(2); ++s; } if (money < skillCosts[num][skillLevels[num]]) { shopSkillButtons[num].l1._alpha = 100; } else { shopSkillButtons[num].l1._alpha = 0; } button.onRelease = function () { if (money >= skillCosts[num][skillLevels[num]] && skillLevels[num] != 4) { money -= skillCosts[num][skillLevels[num]]; skillLevels[num] += 1; c = shopWeaponButtons.length - 1; while (c >= 0) { createWeaponBuy(shopWeaponButtons[c], c); --c; } c = shopAbilityButtons.length - 1; while (c >= 0) { createAbilityBuy(shopAbilityButtons[c], c); --c; } c = shopSkillButtons.length - 1; while (c >= 0) { createSkillBuy(shopSkillButtons[c], c); --c; } shop.moneyTxt.htmlText = bold('$' + formatNumber(money)); } if (skillsOwned[num]) { t = 0; while (t < 5) { shopSkillInfo[t].e1._alpha = 0; ++t; } shopSkillInfo[num].e1._alpha = 100; shop.char.charIn.t.o.bow.gotoAndStop(num + 2); shop.char.charIn.t.o.arrow.gotoAndStop(num + 2); } }; } function createWeaponBuy(button, num) { if (money < weaponCosts[num] && !weaponsOwned[num]) { shopWeaponButtons[num].l1._alpha = 100; shopWeaponButtons[num].bowImg.gotoAndStop(1); } else { shopWeaponButtons[num].l1._alpha = 0; shopWeaponButtons[num].bowImg.t1.gotoAndStop(weaponsOwned[num] ? 2 : 1); } button.onRelease = function () { if (money >= weaponCosts[num] && !weaponsOwned[num]) { weaponsOwned[num] = true; money -= weaponCosts[num]; createShopWeaponUpgrades(num + 1); startingWep = num + 2; c = shopWeaponButtons.length - 1; while (c >= 0) { createWeaponBuy(shopWeaponButtons[c], c); --c; } c = shopAbilityButtons.length - 1; while (c >= 0) { createAbilityBuy(shopAbilityButtons[c], c); --c; } c = shopSkillButtons.length - 1; while (c >= 0) { createSkillBuy(shopSkillButtons[c], c); --c; } shopWeaponButtons[num].bowImg.t1.gotoAndStop(2); shop.moneyTxt.htmlText = bold('$' + formatNumber(money)); t = 0; while (t < 5) { shopWeaponInfo[t].e1._alpha = 0; ++t; } shopWeaponInfo[num].e1._alpha = 100; shop.char.charIn.t.o.bow.gotoAndStop(num + 2); shop.char.charIn.t.o.arrow.gotoAndStop(num + 2); shop.bowNameTxt.htmlText = bold(weaponNames[num]); } if (weaponsOwned[num]) { t = 0; while (t < 5) { shopWeaponInfo[t].e1._alpha = 0; ++t; } startingWep = num + 2; shopWeaponInfo[num].e1._alpha = 100; shop.char.charIn.t.o.bow.gotoAndStop(num + 2); shop.char.charIn.t.o.arrow.gotoAndStop(num + 2); shop.bowNameTxt.htmlText = bold(weaponNames[num]); createShopWeaponUpgrades(num + 1); } }; } function createShopOverButton(button, buttonInfo) { button.onRollOver = function () { buttonInfo.infoer._alpha = 100; button.gotoAndStop(2); }; button.onRollOut = function () { buttonInfo.infoer._alpha = 0; button.gotoAndStop(1); }; button.onReleaseOutside = function () { buttonInfo.infoer._alpha = 0; button.gotoAndStop(1); }; } function createParticles(amount, object) { p = 0; while (p < amount) { particle = attachMovie('particle', 'particle' + highDepth, highDepth++); particle._yscale = random(60) + 20; particle._xscale = particle._yscale; particle.Speed = 1 + Math.random() * 25; particle.Dir = Math.PI * Math.random() * 2; particle.xSpeed = Math.cos(particle.Dir) * particle.Speed; particle.ySpeed = Math.sin(particle.Dir) * particle.Speed; particle._x = bgItems._x + object._x; particle._y = bgItems._y + object._y; particle.Type = 1; particles.push(particle); ++p; } } function createParticles2(xVal, yVal, amount) { p = 0; while (p < amount) { particle = attachMovie('particle2', 'particle' + highDepth, highDepth++); particle._yscale = random(60) + 20; particle._xscale = particle._yscale; particle._alpha = random(100); particle.Speed = 1 + Math.random() * 10; particle.Dir = Math.PI * Math.random() * 2; particle.xSpeed = Math.cos(particle.Dir) * particle.Speed; particle.ySpeed = Math.sin(particle.Dir) * particle.Speed; particle._rotation = particle.Dir * 180 / Math.PI; particle._x = xVal; particle._y = yVal; particle.Type = 2; particle.timeDelay = 10 + random(10); particles.push(particle); ++p; } } function particleManagement() { p = particles.length - 1; while (p >= 0) { particle = particles[p]; particle._x += particle.xSpeed; particle._y += particle.ySpeed; particle.ySpeed *= 0.85; particle.xSpeed = particle.ySpeed; if (particle.Type == 1) { particle._alpha -= (100 - particle._alpha) / 10 + 1; if (particle._alpha <= 0) { removeParticle(); } } if (particle.Type == 2) { particle.timeDelay -= 1; if (particle.timeDelay <= 0) { removeParticle(); } } --p; } } function removeParticle() { particle.removeMovieClip(); particles.splice(p, 1); } function shaker() { if (gameDone && shake != 0) { shake = 3; } if (shake == 0) { } else { if (shake == 1) { shake += 1; _root._x += 2; _root._y += 2; } else { if (shake == 2) { shake += 1; _root._y -= 3; _root._x -= 3; } else { if (shake == 3) { shake = 0; _root._x = 0; _root._y = 0; } } } } } function shoot(shooter, goodArrow) { eBefore = e; if (shake == 0) { shake = 1; } arrower = createEmptyMovieClip('arrower' + depth, depth++); if (shooter != char) { arrower.ID = shooter.ID; } else { arrower.ID = 0; } arrower.isGood = goodArrow; arrower.rot = shooter._rotation + Math.random() * 14 - 7; arrower.tsIn = 30; arrowMC = arrower.createEmptyMovieClip('arrowMC' + depth, depth++); arrower.arrowMC = arrowMC; arrowMC.lineStyle(1, 16777215); arrower.startX = shooter._x - bg._x; arrower.startY = shooter._y - bg._y; arrowMC.moveTo(shooter._x, shooter._y); if (!goodArrow) { xmoveAdd = Math.cos(arrower.rot * Math.PI / 180) * 30; ymoveAdd = Math.sin(arrower.rot * Math.PI / 180) * 30; } else { xmoveAdd = Math.cos(shooter._rotation * Math.PI / 180) * 30; ymoveAdd = Math.sin(shooter._rotation * Math.PI / 180) * 30; } currentX = shooter._x; currentY = shooter._y; arrower.arRealSpeed = 0; t = 0; while (t <= 30) { currentX += xmoveAdd; currentY += ymoveAdd; arrowMC.lineTo(currentX, currentY); Stopped = false; bb = enemies.length - 1; while (bb >= 0) { enemyB = enemies[bb]; if (enemyB != shooter) { if (enemyB.charOnScreen && (enemyB.isGood == !goodArrow || gameMode == 2) && enemyB != shooter) { if (enemyB.charIn.enBody2.hitTest(currentX, currentY, true)) { Stopped = true; arrower.tsIn = t; t = 31; enemyB.charIn.gotoAndPlay(2); blood = attachMovie('blood', 'blood' + depth, depth++); blood.gotoAndStop(random(4) + 1); blood._x = enemyB._x; blood._y = enemyB._y; blood._rotation = char._rotation; bloods.push(blood); dmg = approx(50 + (Math.random() > criticalChance[skillLevels[2]] ? 50 : 0)); if (shooter == char) { dmg = approx(weaponPowers[weaponLevels[1][weaponUsed - 1]][weaponUsed - 1] + (Math.random() > criticalChance[skillLevels[2]] ? weaponPowers[weaponLevels[1][weaponUsed - 1]][weaponUsed - 1] : 0)); } enemyB.health -= dmg; enemyB.lastAttacker = shooter.ID; ahit.start(); damageStuff(enemyB, dmg); enemyB.hBar.inBar._xscale = (enemyB.health / enemyB.healthMax) * 100; if (enemyB.health <= 0) { if ((gameMode == 3 || gameMode == 6 && (teacherNum == 10 || teacherNum == 11)) && theSurvivor == enemyB.ID) { theSurvivor = arrower.ID; if (shooter == char) { char.gotoAndStop(2); startInfo(18); } else { k = enemies.length - 1; while (k >= 0) { if (enemies[k].ID == arrower.ID) { enemies[k].gotoAndStop(2); } --k; } } } shake = 1; explosion = attachMovie('explosion', 'explosion' + highDepth, highDepth++); explosion._x = enemyB._x; explosion._y = enemyB._y; er = explosion.attachMovie('enemyReward', 'enemyReward' + highDepth, highDepth++); er.r1.moneyTxt.htmlText = bold(enemyValue[level - 1]); money += enemyValue[level - 1]; enemyRewards.push(explosion); if (!gameDone) { if (enemyB.isGood) { enemyKills += 1; } else { kills += 1; } bowKills[4] += 1; playerKills += 1; totalKills += 1; testKills(); enemyDeaths[enemy.ID - 1] += 1; } removeEnemyB(); } hitEnemy = true; bb = -1; } } } --bb; } if (!Stopped) { d = dragons.length - 1; while (d >= 0) { dragon = dragons[d]; if (dragon.dIn.hBox.hitTest(currentX, currentY, true)) { Stopped = true; arrower.tsIn = t; t = 31; dragon.gotoAndPlay((dragon.Type - 1) * 10 + 2); blood = attachMovie('blood', 'blood' + depth, depth++); blood.gotoAndStop(random(4) + 1); blood._x = dragon._x; blood._y = dragon._y; blood._rotation = char._rotation; bloods.push(blood); dmg = approx(weaponPowers[weaponLevels[1][weaponUsed - 1]][weaponUsed - 1] + (Math.random() > criticalChance[skillLevels[2]] ? weaponPowers[weaponLevels[1][weaponUsed - 1]][weaponUsed - 1] : 0)); dragon.health -= dmg; ahit.start(); damageStuff(dragon, dmg); hud.bh.tBar._xscale = (dragon.health / dragon.healthMax) * 100; if (dragon.health <= 0) { hud.bh.tBar._xscale = 0; shake = 1; explosion = attachMovie('explosion', 'explosion' + highDepth, highDepth++); explosion._x = dragon._x; explosion._y = dragon._y; er = explosion.attachMovie('enemyReward', 'enemyReward' + highDepth, highDepth++); er.r1.moneyTxt.htmlText = bold(dragonValue[(level - 1) / 7 - 1]); money += dragonValue[dragon.Type - 1]; enemyRewards.push(explosion); removeDragon(); } } --d; } } if (!Stopped) { f = funEnemies.length - 1; while (f >= 0) { en = funEnemies[f]; if (en.hitTest(currentX, currentY, true)) { Stopped = true; arrower.tsIn = t; t = 31; blood = attachMovie('blood', 'blood' + depth, depth++); blood.gotoAndStop(random(4) + 1); blood._x = en._x; blood._y = en._y; blood._rotation = char._rotation; bloods.push(blood); dmg = approx(weaponPowers[weaponLevels[1][weaponUsed - 1]][weaponUsed - 1] + (Math.random() > criticalChance[skillLevels[2]] ? weaponPowers[weaponLevels[1][weaponUsed - 1]][weaponUsed - 1] : 0)); en.Health -= dmg; ahit.start(); damageStuff(en, dmg); if (en.Health <= 0) { shake = 1; removeFunEnemy(); } } --f; } } if (!Stopped) { if (bgItems.fieldItems.hitTest(currentX, currentY, true)) { arrower.tsIn = t; t = 31; } if (shooter != char) { if (char.charIn.abox.hitTest(currentX, currentY, true)) { Stopped = true; arrower.tsIn = t; t = 31; testAgainst(2); e = -1; } } } ++t; } specArrows.push(arrower); e = eBefore; } stop(); _quality = 'MEDIUM'; var loop = new Sound(); loop.attachSound('song.wav'); loop.start(0, 100000); var ashot = new Sound(); ashot.attachSound('ashot.mp3'); var ahit = new Sound(); ahit.attachSound('ahit.mp3'); qualityLevel = 2; playerPause = false; alphaHover(pbtn); alphaHover(mbtn); alphaHover(qbtn); alphaHover(hbtn); pbtn.onRelease = function () { playerPause = !playerPause; pauseStuff(); }; if (muted2) { song.setVolume(0); } mbtn.onRelease = function () { if (muted2) { muted2 = !muted2; loop.setVolume(100); } else { muted2 = !muted2; loop.setVolume(0); } }; if (qualityLevel == 1) { _quality = 'LOW'; } if (qualityLevel == 2) { _quality = 'MEDIUM'; } if (qualityLevel == 3) { _quality = 'HIGH'; } qbtn.onRelease = function () { if (_quality == 'LOW') { _quality = 'MEDIUM'; qualityLevel = 2; } else { if (_quality == 'MEDIUM') { _quality = 'HIGH'; qualityLevel = 3; } else { _quality = 'LOW'; qualityLevel = 1; } } }; screenOn = false; hButtons = new Array(helpScreen.h1, helpScreen.h2, helpScreen.h3, helpScreen.h4, helpScreen.h5, helpScreen.h6); hButtonsAll = new Array(helpScreen.h1, helpScreen.h2, helpScren.h3, helpScreen.h4, helpScreen.h5, helpScreen.h6, helpScreen.h7, helpScreen.h8); hbtn.onRelease = function () { if (!screenOn) { screenOn = true; h = 0; while (h < hButtons.length) { createSecondHover(hButtons[h], h); ++h; } helpScreen.h7.onRollOver = function () { helpScreen.h7.gotoAndStop(2); }; helpScreen.h7.onRollOut = function () { helpScreen.h7.gotoAndStop(1); }; helpScreen.h7.onReleaseOutside = function () { helpScreen.h7.gotoAndStop(1); }; helpScreen.h7.onRelease = function () { screenOn = false; helpScreen._alpha = 0; rada._alpha = 100; h = 0; while (h < hButtonsAll.length) { delete hButtonsAll[h].onRollOver; delete hButtonsAll[h].onRollOut; delete hButtonsAll[h].onRelease; delete hButtonsAll[h].onReleaseOutside; ++h; } }; helpScreen.h8.onRollOver = function () { helpScreen.h8.gotoAndStop(2); }; helpScreen.h8.onRollOut = function () { helpScreen.h8.gotoAndStop(1); }; helpScreen.h8.onReleaseOutside = function () { helpScreen.h8.gotoAndStop(1); }; helpScreen.h8.onRelease = function () { helpScreen.gotoAndStop(1); h = 0; while (h < hButtons.length) { createSecondHover(hButtons[h], h); ++h; } }; rada._alpha = 0; helpScreen._alpha = 100; } else { screenOn = false; helpScreen._alpha = 0; rada._alpha = 100; h = 0; while (h < hButtonsAll.length) { delete hButtonsAll[h].onRollOver; delete hButtonsAll[h].onRollOut; delete hButtonsAll[h].onRelease; delete hButtonsAll[h].onReleaseOutside; ++h; } } }; awardqueue = new Array(); timeToNextKill = 0; killStreak = 0; killsWithoutDeath = 0; teacher.swapDepths(864333); pbtn.swapDepths(850220); mbtn.swapDepths(850221); qbtn.swapDepths(850222); hbtn.swapDepths(850223); tran.swapDepths(870332); award.swapDepths(880554); hBar.swapDepths(700001); char.swapDepths(500500); bgItems.swapDepths(500400); rings.swapDepths(500302); hud.swapDepths(850700); tellInfo.swapDepths(850362); t1.swapDepths(860100); statInfo.swapDepths(860550); theArrow.swapDepths(860033); to1.swapDepths(600333); helpScreen.swapDepths(860022); rada.swapDepths(866553); helpScreen._alpha = 0; teacher._alpha = 0; to1.removeMovieClip(); tellInfo.c1.nameTxt.htmlText = bold(yourName.toUpperCase()); infos = new Array('Mode: Team Battle', 'Mode: Capture the Flag', 'Mode: Free for All', 'Mode: Survivor', 'Mode: Territory Battle', 'Mode: Dragon Battle', 'You have stolen the flag', 'You have captured the flag', 'You have recovered the enemies flag', 'You have recovered your flag', 'You have dropped the flag', 'You have lost survivor', 'The enemy has stolen the flag', 'The enemy has captured the flag', 'The enemy has dropped the flag', 'The enemy has recovered their flag', 'The enemy has recovered your flag', 'You have obtained survivor', '', '', '2 Kill Streak', '4 Kill Streak', '6 Kill Streak', '8 Kill Streak', '10 Kill Streak', 'You have captured Territory 1', 'You have captured Territory 2', 'You have captured Territory 3', 'You have lost Territory 1', 'You have lost Territory 2', 'You have lost Territory 3', 'You have obtained a compound bow', 'Mode: Tutorial'); tutorialInfo = new Array('Welcome to the tutorial.', 'Press WASD or Arrow Keys', 'Click to shoot'); stageHeight = Stage.height - 50; if (achievements[0] != 1) { countDown = attachMovie('countDown', 'countDown', 851550); countDown._x = Stage.width / 2; countDown._y = stageHeight / 2; counting = true; } countDown.stop(); t1._y = Stage.height / 2; gameStarted = false; gamePause = true; tran._x = Stage.width / 2; tran._y = Stage.height / 2; mapOrder = new Array(2, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3, 2, 1, 2, 2, 1, 3); TEAM = 0; CAPTURE = 1; FREE = 2; SURVIVOR = 3; TERRITORY = 4; BOSS = 5; TUTORIAL = 6; levelNames = new Array('Tutorial', 'Level 1 - Team Battle', 'Level 2 - Free For All', 'Level 3 - Survivor', 'Level 4 - Capture The Flag', 'Level 5 - Territory Battle', 'Level 6 - Boss Battle', 'Level 7 - Team Battle', 'Level 8 - Free For All', 'Level 9 - Survivor', 'Level 10 - Capture The Flag', 'Level 11 - Territory Battle', 'Level 12 - Boss Battle', 'Level 13 - Team Battle', 'Level 14 - Free For All', 'Level 15 - Survivor', 'Level 16 - Capture The Flag', 'Level 17 - Territory Battle', 'Level 18 - Free For All', 'Level 19 - Team Battle', 'Level 20 - Capture The Flag', 'Level 21 - Final Boss'); gameModes = new Array(TUTORIAL, TEAM, FREE, SURVIVOR, CAPTURE, TERRITORY, BOSS, TEAM, FREE, SURVIVOR, CAPTURE, TERRITORY, BOSS, TEAM, FREE, SURVIVOR, CAPTURE, TERRITORY, FREE, TEAM, CAPTURE, BOSS); gameMode = gameModes[level - 1]; if (skirmishMode) { gameMode = arraySpots[5]; } bg.gotoAndStop(mapOrder[level - 1]); bgItems.gotoAndStop(1); bgItems.fieldItems.gotoAndStop(1); bgItems2.fieldItems.gotoAndStop(1); bgItems3.fieldItems.gotoAndStop(1); bgItems4.fieldItems.gotoAndStop(1); bgItems5.fieldItems.gotoAndStop(1); bg.bgIn.gotoAndStop(1); manageModes(); bg._x = -(bg.rb._width - Stage.width) / 2; bg._y = -(bg.rb._height - Stage.height) / 2; bgItems._x = bg._x; bgItems._y = bg._y; speeds = new Array(3.5, 4, 4.5, 5, 5.5); healthMaxes = new Array(100, 150, 200, 250, 300); criticalChance = new Array(5, 7, 10, 12, 15); speed = speeds[skillLevels[0]]; friction = 0.7; xSpeed = 0; ySpeed = 0; topRotation = 0; frozen = false; frozenDelay = 60; healthMax = healthMaxes[skillLevels[1]]; health = healthMax; depth = 100; highDepth = 600500; higherDepth = 700500; char.Shadow = attachMovie('shadow', 'shadow' + depth, depth++); char.hBar = hBar; char.hBar.nameTxt.htmlText = yourName.toUpperCase(); char.Shadow._x = char._x; char.Shadow._y = char._y; char.charIn.w.stop(); char.charIn.q.stop(); hudBs = new Array(hud.b1, hud.b2, hud.b3, hud.b4, hud.b5, hud.b6); hudVs = new Array(hud.v1, hud.v2, hud.v3, hud.v4, hud.v5, hud.v6); v = hudVs.length - 1; while (v >= 0) { hudVs[v].theNumTxt.htmlText = bold(v + 1); --v; } hudSpeeds = new Array(0, 0, 0, 0, 0, 0); ammos = new Array(-1, 0, 0, 0, 0, 0); ammoMCs = new Array(); territories = new Array(bgItems.t1, bgItems.t2, bgItems.t3); hudTs = new Array(hud.t1, hud.t2, hud.t3); kills = 0; playerKills = 0; playerDeaths = 0; playerScore = 0; killsGoal = 10; enemyKills = 0; gameDone = false; statThings = new Array(); teacherInformations = new Array('First things first, you need to learn how to move and shoot.', 'Try moving with WASD or arrow keys.', 'Try aiming and shooting with the mouse.', 'Great job, now here comes another player, use your new skills to kill him.', 'Good, now it\'s time to teach you about the different game modes.', 'The first two modes are team battle and free for all.', 'Now let\'s play capture the flag. Walk over the enemies flag to take it. Follow the arrow.', 'Nice, now take it to your flag post to score a point. Follow the white pointer.', 'That was easy, now let\'s play survivor.', 'Shoot the glowing enemy to gain survivor status.', 'Good job, the goal of this mode is to maintain survivor status for as long as possible.', 'Alright, now let\'s try territory battle. The goal is control as many territories as possible.', 'Walk over the territory to gain control of it, defend it from enemy players.', 'Congratulations, you have completed the tutorial, good luck with the rest of the game!'); teacherNum = 0; newTeachDelay = 120; enemyList = new Array('enemy12', 'enemy13', 'enemy14', 'enemy16'); funEnemies = new Array(); funEnDelay = 100; deadEnemies = new Array(); explosionParts = new Array('expp1', 'expp2', 'expp3', 'expp4', 'expp5', 'expp6', 'expp7', 'expp8', 'expp9', 'expp10', 'expp11', 'expp12', 'expp13', 'expp14'); enBullets = new Array(); flagsGoal = 5; points = 0; enemyPoints = 0; timeGoal = 1800; pointsGoal = 8100; playerSelected = char; useWeapon(1); keyListener = new Object(); keyListener.onKeyDown = function () { num = Key.getAscii(); if (num >= 49 && num <= 54) { if (ammos[num - 49] > 0 || num == 49) { useWeapon(num - 48); } } if (num == 112) { playerPause = !playerPause; pauseStuff(); } if (num == 113) { if (_quality == 'LOW') { _quality = 'MEDIUM'; qualityLevel = 2; } else { if (_quality == 'MEDIUM') { _quality = 'HIGH'; qualityLevel = 3; } else { _quality = 'LOW'; qualityLevel = 1; } } } }; Key.addListener(keyListener); genSpots = new Array(bg.bgIn.theBow, bg.bgIn.theBow2, bg.bgIn.theBow3); newWepDelayConst = 150; genChances = new Array(26, 22, 18, 14, 10, 10); startGens(); changeArmor(char, 1); bgItems.fieldItems._alpha = 0; bgItems.fieldItems2._alpha = 0; bgItems.fieldItems3._alpha = 0; bgItems.fieldItems4._alpha = 0; bgItems.fieldItems5._alpha = 0; abilityOn = false; spacePressed = false; abilityMax = 1000; abilityLeft = abilityMax; teledTo1 = false; teledTo2 = false; teledTo3 = false; teledTo4 = false; lastMoney = money; xChange = 0; yChange = 0; hasReleased = false; flags = new Array(); char.hasFlag = false; bgItems.f2.f1.gotoAndStop(2); flagState = 1; enemyFlagState = 1; foundDelay = 0; fireBallDelay = 100 + random(200); dragons = new Array(); dragonHealthMaxes = new Array(1000, 2000, 5000); dragonMax = 1; dragonKilled = false; framesPlayed = 0; smokes = new Array(); smokeDelay = 0; dis = new Array(); shotDelayConst = 15; shotDelay = 0; perfectSurvivor = true; char.respawnTime = 0; floorShots = new Array(); isDead = false; deadDelay = 0; enemyRewards = new Array(); bloods = new Array(); arrows = new Array(); mDown = false; wasMDown = false; onMouseDown = function () { mDown = true; }; onMouseUp = function () { mDown = false; }; enemies = new Array(); enemiesOnLevel = 9; enemyKillsAmt = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0); enemyDeaths = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0); enemyScores = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0); enemiesGood = new Array(true, true, false, false, false, false, false, false, false); enemiesAlive = new Array(false, false, false, false, false, false, false, false, false); enemyNames = new Array('CRAZY GOOSE', 'KEEN FOX', 'DYING BIRD', 'BRAZEN BEAR', 'FREED SNAIL', 'SNEAKY FROG', 'DEVIL SHEEP', 'FROZEN DUCK', 'LUCKY BIRD'); enemiesPerLevel = new Array(3, 3, 2, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3); alliesPerLevel = new Array(2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2); enemyMax = 9; if (skirmishMode) { enemyMax = enemiesPerLevel[level - 1] + alliesPerLevel[level - 1]; enemiesOnLevel = enemyMax; enemyKillsAmt = new Array(enemyMax); enemyDeaths = new Array(enemyMax); enemyScores = new Array(enemyMax); enemiesGood = new Array(enemyMax); enemiesAlive = new Array(enemyMax); d = 0; while (d < enemyMax) { enemyKillsAmt[d] = 0; enemyDeaths[d] = 0; enemyScores[d] = 0; enemiesGood[d] = d < alliesPerLevel[level - 1] ? true : false; enemiesAlive[d] = false; ++d; } enemiesOnLevel = arraySpots[3] + arraySpots[4] + 1; enemiesGood = new Array(); enemyMax = enemiesOnLevel; enemyKillsAmt = new Array(enemyMax); enemyDeaths = new Array(enemyMax); enemyScores = new Array(enemyMax); enemiesAlive = new Array(enemyMax); level = arraySpots[1] * 3; if (arraySpots[5] == 2 || arraySpots[5] == 3) { i = 0; while (i < arraySpots[3] + 1) { enemiesGood.push(true); ++i; } } else { i = 0; while (i < arraySpots[3]) { enemiesGood.push(true); ++i; } } i = 0; while (i < arraySpots[4]) { enemiesGood.push(false); ++i; } } enemyHealthMaxes = new Array(100, 100, 100, 110, 110, 110, 120, 120, 120, 130, 130, 130, 140, 140, 140, 150, 150, 150, 150, 150, 150); enemySpeeds = new Array(1.5, 1.5, 1.5, 1.75, 1.75, 1.75, 2, 2, 2, 2, 2, 2, 2, 2, 2.25, 2.25, 2.25, 2.25, 2.25, 2.25, 2.25); enemySpeeds2 = new Array(3.5, 3.5, 3.5, 3.75, 3.75, 3.75, 3.75, 4, 4.25, 4.5, 4.5, 4.5, 4.75, 4.75, 5, 5, 5, 5, 5, 5, 5); enemyStartingWeps = new Array(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5); enemyAbiltiies = new Array(0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3); enemyAccuracies = new Array(40, 38, 36, 34, 32, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 18, 18, 18); enemyPortals = new Array(bgItems.p1, bgItems.p2, bgItems.p3, bgItems.p4); goodPortals = new Array(); badPortals = new Array(); nuetralPortals = new Array(3, 4); goodPortals.push(1); badPortals.push(2); enemyDelayConst = 10; enemyDelay = 0; appears = new Array(); explosions = new Array(); enCreated = false; enCreated2 = false; enLevels = new Array(0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3); abilityDescriptions = new Array('Invisibilty from enemies', 'Move Twice as fast', 'Block enemy arrows'); abilityNames = new Array('Invisibility', 'Sprint', 'Shield'); abilityCosts = new Array(100, 5000, 50000); weaponDescriptions = new Array('Triple Shot', 'Rapid Fire', 'Homing, Life Steal, Reflective', 'Insane Power', 'Flaming, Explosive'); weaponNames = new Array('Composite Bow', 'Cross Bow', 'Compound Bow', 'Blood Bow', 'Dark Bow'); weaponCosts = new Array(100, 1000, 5000, 20000, 100000); weaponUpgradeNames = new Array('Speed', 'Power', 'Ammo'); bleh = new Array(); levelBgs = new Array(1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4); weaponSpeed1UpgradeCosts = new Array(10, 50, 150); weaponSpeed2UpgradeCosts = new Array(200, 750, 1500); weaponSpeed3UpgradeCosts = new Array(1000, 2000, 5000); weaponSpeed4UpgradeCosts = new Array(5000, 10000, 20000); weaponSpeed5UpgradeCosts = new Array(20000, 50000, 100000); weaponSpeedUpgradeCosts = new Array(bleh, weaponSpeed1UpgradeCosts, weaponSpeed2UpgradeCosts, weaponSpeed3UpgradeCosts, weaponSpeed4UpgradeCosts, weaponSpeed5UpgradeCosts); weaponPower1UpgradeCosts = new Array(10, 50, 150); weaponPower2UpgradeCosts = new Array(200, 750, 1500); weaponPower3UpgradeCosts = new Array(1000, 2000, 5000); weaponPower4UpgradeCosts = new Array(5000, 10000, 20000); weaponPower5UpgradeCosts = new Array(20000, 50000, 100000); weaponPowerUpgradeCosts = new Array(bleh, weaponPower1UpgradeCosts, weaponPower2UpgradeCosts, weaponPower3UpgradeCosts, weaponPower4UpgradeCosts, weaponPower5UpgradeCosts); weaponAmmo1UpgradeCosts = new Array(10, 50, 150); weaponAmmo2UpgradeCosts = new Array(200, 750, 1500); weaponAmmo3UpgradeCosts = new Array(1000, 2000, 5000); weaponAmmo4UpgradeCosts = new Array(5000, 10000, 20000); weaponAmmo5UpgradeCosts = new Array(20000, 50000, 100000); weaponAmmoUpgradeCosts = new Array(bleh, weaponAmmo1UpgradeCosts, weaponAmmo2UpgradeCosts, weaponAmmo3UpgradeCosts, weaponAmmo4UpgradeCosts, weaponAmmo5UpgradeCosts); weaponUpgradeCosts = new Array(weaponSpeedUpgradeCosts, weaponPowerUpgradeCosts, weaponAmmoUpgradeCosts); weaponLevels = new Array(weaponSpeedLevels, weaponPowerLevels, weaponAmmoLevels); weapon1Speeds = new Array(20, 20, 5, 20, 30, 20); weapon2Speeds = new Array(18, 18, 4, 18, 27, 18); weapon3Speeds = new Array(16, 16, 3, 16, 23, 16); weapon4Speeds = new Array(14, 14, 2, 14, 20, 14); weaponSpeeds = new Array(weapon1Speeds, weapon2Speeds, weapon3Speeds, weapon4Speeds); weapon1Powers = new Array(15, 12, 10, 20, 40, 25); weapon2Powers = new Array(17, 13, 9, 22, 45, 30); weapon3Powers = new Array(19, 15, 8, 24, 50, 35); weapon4Powers = new Array(21, 17, 7, 26, 60, 40); weaponPowers = new Array(weapon1Powers, weapon2Powers, weapon3Powers, weapon4Powers); weaponStrengths = new Array(15, 12, 10, 12, 40, 25); weapon1Ammos = new Array(-1, 15, 40, 15, 8, 15); weapon2Ammos = new Array(-1, 18, 44, 18, 10, 18); weapon3Ammos = new Array(-1, 21, 48, 21, 12, 21); weapon4Ammos = new Array(-1, 24, 52, 24, 15, 24); weaponAmmos = new Array(weapon1Ammos, weapon2Ammos, weapon3Ammos, weapon4Ammos); weaponStats = new Array(weaponSpeeds, weaponPowers, weaponAmmos); speedCosts = new Array(100, 1000, 10000, 50000); armorCosts = new Array(100, 1000, 10000, 50000); powerCosts = new Array(100, 1000, 10000, 50000); skillCosts = new Array(speedCosts, armorCosts, powerCosts); skillNames = new Array('Speed', 'Armor', 'Power'); mapNames = new Array('Wasteland', 'Grassy Field', 'Volcano', 'Darkness'); modeNames = new Array('Team Battle', 'Capture the Flag', 'Free For All', 'Survivor', 'Territory', 'Boss Battle', 'Tutorial'); levelDifficulties = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); inShop = false; lSelected = levelsUnlocked; skillDescs = new Array('Speed Increase', 'Health Increase', 'Critical Chance Increase'); particles = new Array(); shake = 0; Object.prototype.getFps = function () { if (signal == true) { time = getTimer(); signal = !signal; return tempo; } tempo = int(1000 / (getTimer() - time)); signal = !signal; return tempo; }; arSpeed = 0; arRealSpeed = 0; arLeft = true; enemyValue = new Array(10, 15, 20, 30, 40, 50, 65, 80, 100, 125, 150, 175, 200, 230, 260, 290, 320, 350, 400, 450, 500, 600); dragonValue = new Array(1000, 2000, 3000); moreShots = 0; specArrows = new Array(); if (achievements[0] == 1 && !skirmishMode) { createShop(); } else { giveAward(1); } if (skirmishMode) { bg.gotoAndStop(mapChoice + 1); if (arraySpots[5] == 0) { } } changeArmor(teacher.char, 4); if (!skirmishMode) { setUpEnemyArrays(); } selectLevel(random(4) + 1); manageModes(); } movieClip 462 { } movieClip 468 { } movieClip 469 { } movieClip 470 { frame 1 { stop(); } } movieClip 473 { } movieClip 475 { } movieClip 476 { } movieClip 477 generator { } movieClip 480 { } movieClip 481 { frame 1 { stop(); } } movieClip 483 { } movieClip 484 { frame 1 { stop(); } } movieClip 486 { } movieClip 487 { frame 1 { stop(); } } movieClip 490 w6 { } movieClip 491 { frame 1 { stop(); } } movieClip 493 w7 { } movieClip 494 { frame 1 { stop(); } } movieClip 497 { } movieClip 498 { frame 1 { stop(); } } movieClip 501 { } movieClip 502 { frame 1 { stop(); } } movieClip 505 { } movieClip 506 { frame 1 { stop(); } } movieClip 509 { } movieClip 511 { frame 1 { stop(); } } movieClip 515 { } movieClip 519 { } movieClip 522 { } movieClip 524 { } movieClip 527 { frame 1 { stop(); } } movieClip 535 { frame 1 { stop(); } } movieClip 538 { } movieClip 541 { } movieClip 542 { frame 1 { stop(); } } movieClip 545 { } movieClip 547 { } movieClip 548 { } movieClip 549 { frame 1 { stop(); } } movieClip 550 { frame 1 { stop(); } frame 90 { stop(); } } movieClip 556 { frame 1 { stop(); } } movieClip 559 { frame 1 { stop(); } } movieClip 562 { frame 1 { stop(); } } movieClip 565 { } movieClip 567 { } movieClip 568 { } movieClip 569 { } movieClip 574 flager { frame 1 { stop(); } } movieClip 575 flag { } movieClip 577 { frame 1 { stop(); } } movieClip 579 { frame 1 { stop(); } } movieClip 581 { frame 1 { stop(); } } movieClip 583 { frame 1 { stop(); } } movieClip 585 { frame 1 { stop(); } } movieClip 587 { frame 1 { stop(); } } movieClip 589 { frame 1 { stop(); } } movieClip 590 { frame 1 { stop(); } } movieClip 592 reticle { } movieClip 599 { } movieClip 601 { } movieClip 602 { frame 1 { stop(); } } movieClip 603 smoke { frame 20 { this.removeMovieClip(); } } movieClip 605 { } movieClip 606 { } movieClip 607 { } movieClip 609 { } movieClip 611 { } movieClip 613 { } movieClip 615 spike9 { } movieClip 617 { } movieClip 619 spike8 { } movieClip 621 { } movieClip 622 arrow { frame 1 { stop(); } } movieClip 625 shadow { } movieClip 638 { frame 1 { stop(); } } movieClip 645 { frame 1 { stop(); } } movieClip 646 { } movieClip 659 { frame 1 { stop(); } } movieClip 672 { frame 1 { stop(); } } movieClip 679 { frame 1 { stop(); } } movieClip 684 { frame 1 { stop(); } } movieClip 686 { } movieClip 688 { } movieClip 689 { frame 1 { stop(); } } movieClip 706 { frame 1 { stop(); } } movieClip 707 { } movieClip 708 { frame 1 { stop(); } } movieClip 709 { frame 1 { stop(); } } movieClip 710 { frame 1 { stop(); } } movieClip 711 { frame 1 { stop(); } frame 2 { stop(); } } movieClip 724 { frame 1 { stop(); } } movieClip 725 { } movieClip 738 hat { frame 1 { stop(); } } movieClip 739 { } movieClip 740 { } movieClip 741 { } movieClip 742 { frame 1 { stop(); } } movieClip 744 { } movieClip 745 { frame 60 { _parent.gotoAndStop(1); } } movieClip 746 { frame 1 { stop(); } } movieClip 748 { } movieClip 749 { } movieClip 750 char { frame 1 { stop(); } } movieClip 751 { } movieClip 752 appear { } movieClip 753 particle { } movieClip 758 { } movieClip 761 { frame 1 { stop(); } } movieClip 768 { frame 1 { stop(); } } // unknown tag 88 length 63 movieClip 771 healthBar { } movieClip 774 { } // unknown tag 88 length 151 movieClip 777 { } movieClip 778 enemyReward { frame 45 { this.removeMovieClip(); } } movieClip 875 { frame 48 { _parent.removeMovieClip(); } } movieClip 876 { } movieClip 877 explosion { } movieClip 889 { } movieClip 890 { } movieClip 893 { } movieClip 912 { frame 30 { _parent.gotoAndStop(4); } } movieClip 915 { } movieClip 939 { frame 25 { _parent.gotoAndStop(4); } } movieClip 968 { } movieClip 977 { frame 8 { _parent.gotoAndStop(4); } } movieClip 994 { frame 15 { gotoAndPlay(1); } } movieClip 1018 { } movieClip 1019 dragonDeath { frame 14 { _parent.removeMovieClip(); } } movieClip 1020 { frame 1 { stop(); } } movieClip 1031 { } movieClip 1050 { } movieClip 1065 { frame 25 { _parent.gotoAndStop(4); } } movieClip 1094 { } movieClip 1103 { frame 8 { _parent.gotoAndStop(4); } } movieClip 1120 { frame 16 { gotoAndPlay(1); } } movieClip 1143 { } movieClip 1144 dragonDeath2 { frame 14 { _parent.removeMovieClip(); } } movieClip 1145 { frame 1 { stop(); } } movieClip 1156 { } movieClip 1175 { frame 30 { _parent.gotoAndStop(4); } } movieClip 1190 { frame 25 { _parent.gotoAndStop(4); } } movieClip 1217 { } movieClip 1226 { frame 8 { _parent.gotoAndStop(4); } } movieClip 1241 { frame 15 { gotoAndPlay(1); } } movieClip 1264 { } movieClip 1265 dragonDeath3 { frame 14 { _parent.removeMovieClip(); } } movieClip 1266 { frame 1 { stop(); } } movieClip 1267 dragon { frame 1 { stop(); } frame 10 { gotoAndStop(1); } frame 11 { stop(); } frame 20 { gotoAndStop(11); } frame 21 { stop(); } frame 30 { gotoAndStop(21); } } movieClip 1271 { } movieClip 1274 { } movieClip 1275 tellPlayer { frame 1 { stop(); } } movieClip 1278 { } movieClip 1281 { } movieClip 1283 { } // unknown tag 88 length 146 movieClip 1292 { frame 1 { stop(); } } movieClip 1293 { frame 1 { stop(); } } movieClip 1294 { frame 1 { stop(); } } movieClip 1295 { frame 1 { stop(); } } movieClip 1296 { frame 1 { stop(); } } movieClip 1299 { frame 1 { stop(); } } movieClip 1300 { frame 1 { stop(); } } movieClip 1304 { } movieClip 1307 { } movieClip 1310 { frame 1 { stop(); } } movieClip 1312 { } movieClip 1313 { } // unknown tag 88 length 67 movieClip 1317 { } movieClip 1320 { } movieClip 1322 { } movieClip 1324 { } movieClip 1325 { } movieClip 1330 { } movieClip 1336 itemTop { } movieClip 1337 { } movieClip 1339 { } movieClip 1340 ammo { } movieClip 1342 { } movieClip 1343 damageInfo { } movieClip 1345 itemBottom { } movieClip 1347 itemMiddle { } movieClip 1351 { frame 1 { stop(); } } movieClip 1356 enBar { } movieClip 1358 { } movieClip 1361 { } movieClip 1363 { } movieClip 1365 { } movieClip 1372 spawn { frame 90 { this.removeMovieClip(); } } movieClip 1377 { } movieClip 1378 { frame 15 { stop(); } } movieClip 1379 { } movieClip 1414 { } movieClip 1449 { } movieClip 1484 { } movieClip 1519 { } movieClip 1554 { } movieClip 1555 fireball { frame 1 { stop(); } } movieClip 1560 winLose { frame 1 { stop(); } } movieClip 1561 { } movieClip 1562 { frame 1 { stop(); } frame 50 { stop(); } } movieClip 1567 { frame 1 { stop(); } } movieClip 1568 { frame 1 { stop(); } } movieClip 1573 { frame 1 { stop(); } } movieClip 1574 { } movieClip 1576 { } movieClip 1577 { } movieClip 1588 { frame 1 { stop(); } } movieClip 1589 { } movieClip 1595 { frame 1 { stop(); } } movieClip 1598 { } movieClip 1601 { } movieClip 1603 { frame 1 { stop(); } } movieClip 1605 { frame 1 { stop(); } } movieClip 1612 { } movieClip 1614 { } movieClip 1615 { } movieClip 1617 { } movieClip 1618 shop { } movieClip 1619 particle2 { } movieClip 1625 { frame 1 { stop(); } frame 3 { stop(); } } movieClip 1626 countDown { frame 8 { _root.shake = 1; } frame 22 { t1.nextFrame(); } } movieClip 1628 { } movieClip 1631 { } movieClip 1633 pauseScreen { } movieClip 1640 { frame 11 { stop(); } } movieClip 1642 { frame 1 { stop(); } } movieClip 1646 { frame 1 { stop(); } } movieClip 1651 { } movieClip 1652 { frame 1 { stop(); } } movieClip 1656 { frame 1 { stop(); } } movieClip 1657 levelSelectScreen { } movieClip 1662 { frame 1 { stop(); } } movieClip 1706 { } movieClip 1711 { } movieClip 1713 { } movieClip 1742 { } movieClip 1764 { frame 1 { stop(); } } movieClip 1766 { } movieClip 1769 { } movieClip 1770 { } movieClip 1772 { } movieClip 1773 { } movieClip 1775 { } movieClip 1777 enemyRadar { frame 1 { stop(); } } movieClip 1778 { } movieClip 1782 { } movieClip 1783 { frame 1 { stop(); } } movieClip 1784 { frame 60 { stop(); } } movieClip 1785 { } movieClip 1846 { } movieClip 1847 { } movieClip 1848 { } movieClip 1879 { frame 15 { _parent.gotoAndStop(1); } } movieClip 1900 { frame 10 { _parent.removeMovieClip(); } } movieClip 1901 enemy12 { frame 1 { stop(); } frame 1 { stop(); } } movieClip 1932 { } movieClip 1973 { frame 20 { _parent.gotoAndStop(1); } } movieClip 1974 { frame 1 { _parent.removeMovieClip(); } } movieClip 1975 enemy13 { frame 1 { stop(); } } movieClip 1978 { } movieClip 1979 expp1 { } movieClip 1982 expp2 { } movieClip 1985 expp3 { } movieClip 1988 expp4 { } movieClip 1991 expp5 { } movieClip 1994 expp6 { } movieClip 1997 expp7 { } movieClip 2000 expp8 { } movieClip 2003 exp9 { } movieClip 2006 expp10 { } movieClip 2009 expp11 { } movieClip 2012 expp12 { } movieClip 2015 expp13 { } movieClip 2018 expp14 { } movieClip 2049 { } movieClip 2066 { frame 10 { _parent.gotoAndStop(1); } } movieClip 2097 { frame 15 { _parent.removeMovieClip(); } } movieClip 2098 enemy14 { frame 1 { stop(); } } movieClip 2129 { } movieClip 2150 { frame 10 { _parent.gotoAndStop(1); } } movieClip 2171 { frame 10 { _parent.removeMovieClip(); } } movieClip 2172 enemy16 { frame 1 { stop(); } } frame 5 { createGenHover(b1); b1.onRelease = function () { gotoAndStop(3); }; } movieClip 2183 { } instance of movieClip 2183 { onClipEvent (release) { getURL('http://armorgames.com', '_BLANK'); } } frame 6 { function bold(item) { return '<b>' + item + '</b>'; } function createLButton(button) { button.onRollOver = function () { button.gotoAndStop(2); }; button.onRollOut = function () { button.gotoAndStop(1); }; button.onReleaseOutside = function () { button.gotoAndStop(1); }; } function createRButton(button) { button.onRollOver = function () { button.gotoAndStop(2); }; button.onRollOut = function () { button.gotoAndStop(1); }; button.onReleaseOutside = function () { button.gotoAndStop(1); }; } function blackButton(num) { lButtons[num].gotoAndStop(3); delete lButtons[num].onRollOver; delete lButtons[num].onRollOut; delete lButtons[num].onReleaseOutside; delete lButtons[num].onRelease; rButtons[num].gotoAndStop(3); delete rButtons[num].onRollOver; delete rButtons[num].onRollOut; delete rButtons[num].onReleaseOutside; delete rButtons[num].onRelease; } function createLRButton(button1, button2, num) { createLButton(button1); createRButton(button2); button1.gotoAndStop(1); button2.gotoAndStop(1); infoArray[num].htmlText = bold(skirmishArrays[num][arraySpots[num]]); if (num == 3) { if (arraySpots[5] == 2 || arraySpots[5] == 3) { infoArray[3].htmlText = bold(allies2Array[arraySpots[3]]); } else { if (arraySpots[3] >= 3) { arraySpots[3] = 3; infoArray[num].htmlText = bold(skirmishArrays[num][arraySpots[num]]); } } } if (num == 0) { infoArray[num].htmlText = bold(skirmishArrays[num][arraySpots[5]][arraySpots[num]]); } button1.onRelease = function () { arraySpots[num] -= 1; if (arraySpots[num] == -1 && num != 0 && (num != 3 || arraySpots[5] != 2 && arraySpots[5] != 3)) { arraySpots[num] = skirmishArrays[num].length - 1; } else { if (arraySpots[num] == -1 && num == 0) { arraySpots[num] = skirmishArrays[num][arraySpots[5]].length - 1; } else { if (arraySpots[num] == -1 && num == 3) { arraySpots[num] = allies2Array.length - 1; } } } infoArray[num].htmlText = bold(skirmishArrays[num][arraySpots[num]]); if (num == 0 || num == 5) { infoArray[0].htmlText = bold(skirmishArrays[0][arraySpots[5]][arraySpots[0]]); } if (num == 3) { if (arraySpots[5] == 2 || arraySpots[5] == 3) { infoArray[3].htmlText = bold(allies2Array[arraySpots[3]]); } } if (num == 5) { gameModeTxt.htmlText = modeDescriptions[arraySpots[num]]; if (arraySpots[num] == 2 || arraySpots[num] == 3) { als.gotoAndStop(2); ens.gotoAndStop(2); blackButton(4); infoArray[4].htmlText = ''; } else { als.gotoAndStop(1); ens.gotoAndStop(1); createLRButton(lButtons[4], rButtons[4], 4); } if (arraySpots[num] == 5) { blackButton(3); blackButton(4); infoArray[3].htmlText = ''; infoArray[4].htmlText = ''; als.gotoAndStop(3); ens.gotoAndStop(2); } else { createLRButton(lButtons[3], rButtons[3], 3); if (arraySpots[num] != 2 && arraySpots[num] != 3) { createLRButton(lButtons[4], rButtons[4], 4); } } } }; button2.onRelease = function () { arraySpots[num] += 1; if (arraySpots[num] == skirmishArrays[num].length && num != 0 && (num != 3 || arraySpots[5] != 2 && arraySpots[5] != 3)) { arraySpots[num] = 0; } else { if (arraySpots[num] == skirmishArrays[num][arraySpots[5]].length && num == 0) { arraySpots[num] = 0; } else { if (arraySpots[num] == allies2Array.length && num == 3) { arraySpots[num] = 0; } } } infoArray[num].htmlText = bold(skirmishArrays[num][arraySpots[num]]); if (num == 0 || num == 5) { infoArray[0].htmlText = bold(skirmishArrays[0][arraySpots[5]][arraySpots[0]]); } if (num == 3) { if (arraySpots[5] == 2 || arraySpots[5] == 3) { infoArray[3].htmlText = bold(allies2Array[arraySpots[3]]); } } if (num == 5) { gameModeTxt.htmlText = modeDescriptions[arraySpots[num]]; if (arraySpots[num] == 2 || arraySpots[num] == 3) { als.gotoAndStop(2); ens.gotoAndStop(2); blackButton(4); infoArray[4].htmlText = ''; } else { als.gotoAndStop(1); ens.gotoAndStop(1); createLRButton(lButtons[4], rButtons[4], 4); } if (arraySpots[num] == 5) { blackButton(3); blackButton(4); infoArray[3].htmlText = ''; infoArray[4].htmlText = ''; als.gotoAndStop(3); ens.gotoAndStop(2); } else { createLRButton(lButtons[3], rButtons[3], 3); if (arraySpots[num] != 2 && arraySpots[num] != 3) { createLRButton(lButtons[4], rButtons[4], 4); } } } }; } function onEnterFrame() { trace(arraySpots); } createGenHover(b1); createGenHover(p1); lButtons = new Array(l1, l2, l3, l4, l5, l6); rButtons = new Array(r1, r2, r3, r4, r5, r6); arraySpots = new Array(2, 1, 1, 1, 2, 0); points1Array = new Array('3 Kills', '5 Kills', '10 Kills', '25 Kills', '100 Kills'); points2Array = new Array('1 Flag', '2 Flags', '3 Flags', '5 Flags', '10 Flags'); points3Array = new Array('1 Kill', '5 Kills', '10 Kills', '25 Kills', '100 Kills'); points4Array = new Array('30 Seconds', '1 Minute', '2 Minutes', '3 Minutes', '5 Minutes'); points5Array = new Array('3 Minutes', '5 Minutes', '10 Minutes', '15 Minutes', '20 Minutes'); points6Array = new Array('1 Kill', '1 Kill', '1 Kill', '1 Kill', '1 Kill'); pointsArray = new Array(points1Array, points2Array, points3Array, points4Array, points5Array, points6Array); difficultyArray = new Array('Easy', 'Medium', 'Hard', 'Insane'); obstacleArray = new Array('Few', 'Some', 'Many'); alliesArray = new Array('0', '1', '2', '3'); allies2Array = new Array('1', '2', '3', '4', '5', '6'); enemiesArray = new Array('1', '2', '3', '4', '5'); modeNames = new Array('Team Battle', 'Capture the Flag', 'Free For All', 'Survivor', 'Territory', 'Boss Battle'); alliesArrayNums = new Array(0, 1, 2, 3); allies2ArrayNums = new Array(1, 2, 3, 4, 5, 6); modeDescriptions = new Array('In \'Team Battle\' the objective of the game is to kill as many of the enemy team as possible until you reach the point cap.', 'In \'Capture the Flag\' the objective of the game is to fight your way to the enemies spawn point and take their flag. You must then return the flag to your spawn point to score.', 'In \'Free For All\' your goal is to reach the point target before anyone else by killing enemies.', 'In \'Survivor\' your objective is to kill the current the current survivor and then survive as long as possible to gain points.', 'In \'Territory\' the objective of the game is to stand in the territories until you have captured them to gain point.s', 'In \'Boss Battle\' the objective is to kill the dragon without dying.'); skirmishArrays = new Array(pointsArray, difficultyArray, obstacleArray, alliesArray, enemiesArray, modeNames); infoArray = new Array(i1, i2, i3, i4, i5, i6); mapNames = new Array('Wasteland', 'Grassy Field', 'Volcano', 'Darkness'); gameModeTxt.htmlText = modeDescriptions[arraySpots[5]]; i = 0; while (i < lButtons.length) { createLRButton(lButtons[i], rButtons[i], i); ++i; } createLButton(m1, 1); createRButton(m2, 2); mapChoice = 0; mapChoices = 3; m1.onRelease = function () { mapChoice -= 1; if (mapChoice < 0) { mapChoice = mapChoices - 1; } mapImage.gotoAndStop(mapChoice + 1); }; m2.onRelease = function () { mapChoice += 1; if (mapChoice == mapChoices) { mapChoice = 0; } mapImage.gotoAndStop(mapChoice + 1); }; b1.onRelease = function () { gotoAndStop(3); }; p1.onRelease = function () { skirmishMode = true; gotoAndStop(4); }; } movieClip 2194 { frame 1 { stop(); } } movieClip 2199 { frame 1 { stop(); } } // unknown tag 88 length 62 movieClip 2210 { frame 1 { stop(); } } movieClip 2217 { frame 1 { stop(); } } movieClip 2219 { frame 1 { stop(); } } frame 7 { createGenHover(b1); b1.onRelease = function () { gotoAndStop(3); }; createGenHover(p1); p1.onRelease = function () { gotoAndStop(4); }; } frame 8 { theAs = new Array(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32, a33, a34, a35, a36); a = 0; while (a < theAs.length) { theA = theAs[a]; theA.aTxt.htmlText = descros[a]; if (achievements[a] == 1) { theA.c1._alpha = 100; } else { theA.c1._alpha = 0; } ++a; } createGenHover(b1); b1.onRelease = function () { gotoAndStop(3); }; } movieClip 2228 { } frame 9 { function onEnterFrame() {} createGenHover(b1); b1.onRelease = function () { gotoAndStop(3); }; } movieClip 2236 { } movieClip 2237 { frame 430 { stop(); } } frame 10 { function createGameButton(button, num) { button.goMax = false; button.onRollOver = function () { button.goMax = true; }; button.onRollOut = function () { button.goMax = false; }; button.onReleaseOutside = function () { button.goMax = false; }; } function manageMaxes() { g = 0; while (g < gameButtons.length) { gameButton = gameButtons[g]; if (gameButton.goMax) { gameButton._yscale += (150 - gameButton._xscale) / 2; gameButton._xscale = gameButton._yscale; } else { gameButton._yscale += (100 - gameButton._xscale) / 2; gameButton._xscale = gameButton._yscale; } ++g; } } function onEnterFrame() { manageMaxes(); } createGenHover(b1); b1.onRelease = function () { gotoAndStop(3); }; bb2.onRelease = function () { gotoAndStop(3); }; ays._alpha = 0; gameButtons = new Array(qBtn, mBtn, cBtn); if (_quality == 'LOW') { ll.gotoAndStop(1); } else { if (_quality == 'MEDIUM') { ll.gotoAndStop(2); } else { if (_quality == 'HIGH') { ll.gotoAndStop(3); } else { if (_quality == 'BEST') { ll.gotoAndStop(4); } } } } qBtn.onRelease = function () { if (_quality == 'LOW') { _quality = 'MEDIUM'; ll.gotoAndStop(2); } else { if (_quality == 'MEDIUM') { _quality = 'HIGH'; ll.gotoAndStop(3); } else { if (_quality == 'HIGH') { _quality = 'BEST'; ll.gotoAndStop(4); } else { if (_quality == 'BEST') { _quality = 'LOW'; ll.gotoAndStop(1); } } } } }; ll.onRelease = function () { if (_quality == 'LOW') { _quality = 'MEDIUM'; ll.gotoAndStop(2); } else { if (_quality == 'MEDIUM') { _quality = 'HIGH'; ll.gotoAndStop(3); } else { if (_quality == 'HIGH') { _quality = 'BEST'; ll.gotoAndStop(4); } else { if (_quality == 'BEST') { _quality = 'LOW'; ll.gotoAndStop(1); } } } } }; mm.gotoAndStop(muted2 ? 2 : 1); mBtn.onRelease = function () { muted2 = !muted2; mm.gotoAndStop(muted ? 2 : 1); }; mm.onRelease = function () { muted = !muted; mm.gotoAndStop(muted ? 2 : 1); }; cBtn.onRelease = function () { ays._alpha = 100; ays.gotoAndStop(1); ays.yBtn.onRelease = function () { sObject.clear(); delete ays.yBtn.onRelease; delete ays.nBtn.onRelease; ays.gotoAndStop(2); }; ays.nBtn.onRelease = function () { ays._alpha = 0; delete ays.yBtn.onRelease; delete ays.nBtn.onRelease; }; }; g = 0; while (g < gameButtons.length) { gameButton = gameButtons[g]; createGameButton(gameButton, g); ++g; } } movieClip 2244 { frame 1 { stop(); } } movieClip 2247 { frame 1 { stop(); } } movieClip 2249 { } movieClip 2251 { } movieClip 2253 { } movieClip 2255 { } movieClip 2260 { } movieClip 2261 { frame 34 { stop(); } } movieClip 2262 { frame 1 { stop(); } }




http://swfchan.com/43/211634/info.shtml
Created: 7/10 -2018 22:05:40 Last modified: 7/10 -2018 22:05:40 Server time: 05/05 -2024 18:27:50