home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2005-09-29 | 34.8 KB | 1,158 lines
function startFTimer() { startTime = new Date(); _root.startFTime = startTime.getTime(); _root.loopsFTimer = _root.loopsFTimer + 1; } function stopFTimer() { endTime = new Date(); now = endTime.getTime(); _root.totalFTime += now - _root.startFTime; } function startFTimer2() { startTime2 = new Date(); _root.startFTime2 = startTime2.getTime(); _root.loopsFTimer2 = _root.loopsFTimer2 + 1; } function stopFTimer2() { endTime2 = new Date(); now2 = endTime2.getTime(); _root.totalFTime2 += now2 - _root.startFTime2; } function pauseGame() { var _loc1_ = _root; gamePaused = true; _loc1_.ground.stop(); _loc1_.heli.stop(); _loc1_.heli.moveX = 0; _loc1_.heli.moveY = 0; } function unpauseGame() { gamePaused = false; _root.ground.play(); _root.heli.play(); } function updateHealthDisplay() { var _loc1_ = _root; var _loc3_ = 200; var currentHitpoints = _loc1_.heli.hitPoints; var _loc2_ = int(currentHitpoints / _loc3_ * 100); if(_loc2_ <= 10) { if(!_loc1_.alarmplaying) { _loc1_.alarm_sound.start(0,999); _loc1_.alarmplaying = true; } _loc1_.health._alpha = _loc1_.theFlicker2.flick._alpha; } else { _loc1_.health._alpha = 100; } _loc1_.health.gotoAndStop(_loc2_); } function goodieSpawn(posX, posY) { var goodieArray = Array("goodie_shield","goodie_mines","goodie_guided_missiles","goodie_wingman","goodie_primary_upgrade","goodie_primary_upgrade","goodie_cash","goodie_nuke","goodie_health","goodie_unguided_missiles"); var pick = random(goodieArray.length); chosenParent = eval(goodieArray[pick]); var motime2 = new Date(); var checkBack = motime2.getTime(); lastSpawn = checkBack - spawnTime; if(lastSpawn >= 3000) { currentGoodie = chosenParent.duplicateMovieClip("goodie_" + ++goodieCount,heli.o++); currentGoodie._x = posX; currentGoodie._y = posY; _root.goodies.push(currentGoodie); var motime = new Date(); spawnTime = motime.getTime(); } } function killAll() { for(var checker in enemies) { var checkenemy = eval(enemies[checker]); removeMovieClip(checkenemy); } var checker = 0; while(checker <= mineCount) { var currentmine = eval("_root.mine_" + checker); removeMovieClip(currentmine); checker++; } for(var checker in wingmen) { var currentman = _root.wingmen[checker]; removeMovieClip(currentman); } for(var checker in goodies) { var currentgoodie = _root.goodies[checker]; removeMovieClip(currentgoodie); } for(var checker in projectileArray) { var currentprojectile = _root.projectileArray[checker]; removeMovieClip(currentprojectile); } stopAllSounds(); } function checkAlive(target) { var _loc1_ = target; var _loc2_ = _root; if(_loc1_.hitPoints <= 0) { _loc1_._rotation += 10; _loc1_._y += 10; if(_loc1_._y >= 350) { if(!framesSinceExplosion) { explode(_loc1_); if(!_loc1_.amWingman) { life_indicator.play(); } } framesSinceExplosion++; if(framesSinceExplosion >= 20) { if(!_loc1_.amWingman) { _loc2_.upgrades.setSelectedIndex(_loc2_.upgrades.getSelectedIndex() - 1,false); _loc2_.sec_weapon_indc.mines_pool = 0; _loc2_.sec_weapon_indc.nuke_pool = 0; _loc2_.sec_weapon_indc.unguided_pool = 0; _loc2_.sec_weapon_indc.guided_pool = 0; _loc2_.flash_display.gotoAndPlay("life lost"); _loc1_._rotation = 0; _loc1_._y = 50; _loc1_._x = 50; _loc1_._visible = 1; _loc1_._alpha = 100; framesSinceExplosion = 0; _loc1_.hitPoints = 200; alarm_sound.stop(); alarmplaying = false; flicker(_loc1_); shield.hitPoints = 0; _loc1_.shielded = false; shield._x = -1000; shield._y = -1000; updateHealthDisplay(); } else { wingmen = cleanArray(wingmen); } } } } if(heli.hitPoints <= 0) { return false; } return true; } function getClosestEnemy(what) { var _loc1_ = what; _loc1_.smallestDistance = 3000; for(var _loc2_ in enemies) { _loc1_.checkenemy = enemies[_loc2_]; if(_loc1_.checkenemy._x) { _loc1_.distance = int(Math.sqrt(Math.pow(_loc1_.checkenemy._x - _loc1_._x,2) + Math.pow(_loc1_.checkenemy._y - _loc1_._y,2))); if(_loc1_.distance < _loc1_.smallestDistance) { _loc1_.smallestDistance = _loc1_.distance; _loc1_.smallestObject = _loc1_.checkenemy; } } } if(_loc1_.smallestObject) { _root.bee_beep_sound.start(); } return _loc1_.smallestObject; } function shoot() { laserEnabler.gotoAndStop(1); shots++; heli.flash.play(); mode = upgrades.getValue(); if(mode == "Basic MG") { gun_sound2.start(); MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 20; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; } if(mode == "Double MG") { gun_sound2.start(); MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 20; currentProjectile.moveY = -2; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 20; currentProjectile.moveY = 2; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; } if(mode == "Super MG") { gun_sound3.start(); firebolt.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 25; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; } if(mode == "Double Super MG") { gun_sound3.start(); firebolt.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 25; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; firebolt.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 25; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y; } if(mode == "Double MG + Rearfire") { gun_sound3.start(); firebolt.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 25; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; firebolt.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 25; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y; MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = -20; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; } if(mode == "Double MG + Rearfire + Fireball") { gun_sound3.start(); firebolt.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 25; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; firebolt.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 25; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y; MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 20; currentProjectile.moveY = -2; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 20; currentProjectile.moveY = 2; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; } if(mode == "Multi MG + Rearfire + Fireball") { gun_sound3.start(); MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 20; currentProjectile.moveY = -2; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 20; currentProjectile.moveY = 2; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = -20; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 20; currentProjectile.moveY = 4; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; MGshots.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 20; currentProjectile.moveY = -4; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; firebolt.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 25; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y + 10; firebolt.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile.moveX = 25; currentProjectile.moveY = 0; currentProjectile._x = heli._x + 30; currentProjectile._y = heli._y; } _root.projectileArray.push(currentProjectile); } function enemyShoot(how, whichEnemy) { if(random(whichEnemy.reload) == 1 && !_root.gamePaused) { whichEnemy.gotoAndPlay("shoot"); if(how == "bolt") { gun_sound2.start(); weapon_bolt.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; } if(how == "multishot") { gun_sound2.start(); currentProjectile = weapon_rocket2.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; currentProjectile.moveX = -5; currentProjectile.moveY = -1; currentProjectile = weapon_rocket2.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; currentProjectile.moveX = -5; currentProjectile.moveY = -0.8; currentProjectile = weapon_rocket2.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; currentProjectile.moveX = -5; currentProjectile.moveY = 0.8; currentProjectile = weapon_rocket2.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; currentProjectile.moveX = -5; currentProjectile.moveY = 1; } if(how == "laser") { bounce_sound.start(); weapon_laser.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; } if(how == "MG") { gun_sound2.start(); weapon_MG.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; if(whichEnemy._x <= heli._x) { currentProjectile.moveX = -10; } if(whichEnemy._x >= heli._x) { currentProjectile.moveX = 10; } } if(how == "MG_aimed") { gun_sound2.start(); weapon_MG_aimed.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; } if(how == "fireball") { weapon_fireball.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; disappear_sound.start(); } if(how == "ball") { weapon_ball.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; fireburst_sound.start(); } if(how == "doubleball") { weapon_ball.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; weapon_ball.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y + 10; fireburst_sound.start(); } if(how == "fireball_slow") { weapon_fireball_slow.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; fireburst_sound.start(); } if(how == "rocket") { weapon_rocket.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; missile_sound.start(); } if(how == "doublerocket") { weapon_rocket.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x - 40; currentProjectile._y = whichEnemy._y; weapon_rocket.duplicateMovieClip("projectile_" + ++projectileCount,heli.o++); currentProjectile = eval("projectile_" + projectileCount); currentProjectile._x = whichEnemy._x; currentProjectile._y = whichEnemy._y + 5; missile_sound.start(); } } _root.projectileArray.push(currentProjectile); } function changeBrightness(target) { var _loc1_ = target; if(_loc1_.flash == "on") { _loc1_.flash = "off"; var _loc3_ = new Color(_loc1_); var _loc2_ = {rb:"255",gb:"255",bb:"255"}; _loc3_.setTransform(_loc2_); _loc1_.flashFrame += 1; } else { _loc1_.flash = "on"; _loc3_ = new Color(_loc1_); _loc2_ = {rb:"0",gb:"0",bb:"0"}; _loc3_.setTransform(_loc2_); _loc1_.flashFrame += 1; } if(_loc1_.flashFrame >= 9) { clearInterval(_loc1_.flashInterval); _loc1_.flashing = false; _loc3_ = new Color(_loc1_); _loc2_ = {rb:"0",gb:"0",bb:"0"}; _loc3_.setTransform(_loc2_); } } function flicker(what) { var _loc1_ = what; if(!_loc1_.flashing) { _loc1_.flashInterval = setInterval(changeBrightness,25,_loc1_); _loc1_.flashFrame = 0; _loc1_.flashing = true; } } function checkEnemyCollision(which) { var _loc1_ = which; if(!_loc1_.initHitPoints) { _loc1_.initHitPoints = _loc1_.hitPoints; } if(_loc1_.hitTest(heli.hitarea)) { if(!heli.shielded) { explode(_loc1_); flicker(heli); heli.hitPoints -= 50; updateHealthDisplay(); } else { _root.sHit_sound.start(); flicker(shield); shield.hitPoints -= 50; what.removeMovieClip(); if(shield.hitPoints <= 0) { heli.shielded = false; shield.gotoAndStop("cleanframe"); shield._x = -1000; shield._y = -1000; } } } } function enemyCheckHit(what) { var _loc1_ = what; if(_loc1_.hitTest(heli.hitareaLarge)) { if(!heli.shielded) { spark(heli); flicker(heli); heli.hitPoints -= _loc1_.damage; _loc1_.removeMovieClip(); updateHealthDisplay(); } else { _root.sHit_sound.start(); flicker(shield); shield.hitPoints -= _loc1_.damage; _loc1_.removeMovieClip(); if(shield.hitPoints <= 0) { heli.shielded = false; shield.gotoAndStop("cleanframe"); shield._x = -1000; shield._y = -1000; } } } } function checkHit(what, donotremoveorigin) { var _loc1_ = what; var _loc3_ = donotremoveorigin; for(var _loc2_ in enemies) { checkenemy = enemies[_loc2_]; if(_loc1_.hitTest(checkenemy)) { hits++; checkenemy.hitPoints -= _loc1_.damage; if(checkenemy.hitPoints <= 0) { takedowns++; explode(checkenemy,null,true); } else { spark(checkenemy); flicker(checkenemy); } if(!_loc3_) { _loc1_.removeMovieClip(); } } } } function explode(what, nosound, byplayer) { if(!nosound && _root.framesSinceLastExplosion >= 10) { _root.framesSinceLastExplosion = 0; explosion_sound.start(); } if(what.myLooper) { what.myLooper.removeMovieClip(); } explosionsprite.duplicateMovieClip("exSprite_" + ++exSpriteCount,heli.o++); var currentexSprite = eval("exSprite_" + exSpriteCount); currentexSprite._x = what._x; currentexSprite._y = what._y; var getScore = int(what.initHitPoints * 2); if(byplayer == true) { scoreboard.score(getScore); _root.popScore(new String(getScore),what); } goodieSpawn(what._x,what._y); if(what.listener) { what.listener.overrideX = 0; what.listener.overrideY = 0; } what._visible = 0; what.removeMovieClip(); enemies = cleanArray(enemies); } function spark(what) { var randomcloud = eval("cloud" + random(3)); randomcloud.duplicateMovieClip("exSprite_" + ++exSpriteCount,heli.o++); var currentexSprite = eval("exSprite_" + exSpriteCount); currentexSprite._x = what._x; currentexSprite._y = what._y; } function moveEnemy(what, how, direction) { var _loc1_ = what; var _loc2_ = how; if(!_root.gamePaused) { if(_loc1_._x <= -100 || _loc1_._x >= 700 || _loc1_._y >= 440 || _loc1_._y <= -30) { if(!_loc1_.amWingman) { explode(_loc1_,true); } } if(!_loc1_.startPosX) { _loc1_.startPosX = _loc1_._x; } if(!_loc1_.startPosY) { _loc1_.startPosY = _loc1_._y; } if(_loc1_._y >= -30 && !_root.gamePaused) { if(_loc2_ == "random") { if(!_loc1_.destY) { _loc1_.destY = random(400); } if(!_loc1_.destX) { _loc1_.destX = random(550); } if(_loc1_.dochange++ >= 100) { _loc1_.dochange = 0; _loc1_.destY = random(400); _loc1_.destX = random(550); } if(_loc1_._y > _loc1_.destY) { _loc1_.moveY -= random(3) / 10; } if(_loc1_._y < _loc1_.destY) { _loc1_.moveY += random(3) / 10; } if(_loc1_._x > _loc1_.destX) { _loc1_.moveX -= random(3) / 10; } if(_loc1_._x < _loc1_.destX) { _loc1_.moveX += random(3) / 10; } if(_loc1_.moveX >= 4) { _loc1_.moveX = 4; } if(_loc1_.moveX <= -4) { _loc1_.moveX = -4; } if(_loc1_.moveY >= 4) { _loc1_.moveY = 4; } if(_loc1_.moveY <= -4) { _loc1_.moveY = -4; } _loc1_._x += _loc1_.moveX; _loc1_._y += _loc1_.moveY; } if(_loc2_ == "kamikaze") { if(_loc1_.overrideX > 1) { _loc1_.destX = _loc1_.overrideX; } else { _loc1_.destX = heli._x - 50; } if(_loc1_.overrideY > 1) { _loc1_.destY = _loc1_.overrideY; } else { _loc1_.destY = heli._y; } l = 0; if(_loc1_._y > _loc1_.destY) { _loc1_.moveY -= random(3) / 10; } if(_loc1_._y < _loc1_.destY) { _loc1_.moveY += random(3) / 10; } if(_loc1_._x > _loc1_.destX) { _loc1_.moveX -= random(3) / 10; } if(_loc1_._x < _loc1_.destX) { _loc1_.moveX += random(3) / 10; } if(_loc1_.moveX >= 4) { _loc1_.moveX = 4; } if(_loc1_.moveX <= -4) { _loc1_.moveX = -4; } if(_loc1_.moveY >= 4) { _loc1_.moveY = 4; } if(_loc1_.moveY <= -4) { _loc1_.moveY = -4; } _loc1_._x += _loc1_.moveX; _loc1_._y += _loc1_.moveY; } if(_loc2_ == "sine") { if(_loc1_.direction == "right") { _loc1_._x += 2; } else { _loc1_._x -= 2; } _loc1_._y = _loc1_.startPosY + 100 * Math.sin(_loc1_.r += 0.05); if(_loc1_._y < 10) { if(_loc1_.direction == "left") { _loc1_.direction = "right"; } } if(_loc1_._y > 540) { if(_loc1_.direction == "right") { _loc1_.direction = "left"; } } _loc1_.startPosY += _loc1_.driftY; _loc1_.startPosX += _loc1_.driftX; } if(_loc2_ == "zipoff") { if(!_loc1_.accel) { _loc1_.accel = 5; } _loc1_.accel += 0.5; _loc1_._x -= _loc1_.accel; } if(_loc2_ == "getY_stayright") { _loc1_.destY = heli._y; if(_loc1_.dochange++ >= 100) { _loc1_.dochange = 0; _loc1_.destX = random(200) + 440; } if(_loc1_._y > _loc1_.destY) { _loc1_.moveY -= random(3) / 10; } if(_loc1_._y < _loc1_.destY) { _loc1_.moveY += random(3) / 10; } if(_loc1_._x > _loc1_.destX) { _loc1_.moveX -= random(3) / 10; } if(_loc1_._x < _loc1_.destX) { _loc1_.moveX += random(3) / 10; } if(_loc1_.moveX >= 4) { _loc1_.moveX = 4; } if(_loc1_.moveX <= -4) { _loc1_.moveX = -4; } if(_loc1_.moveY >= 4) { _loc1_.moveY = 4; } if(_loc1_.moveY <= -4) { _loc1_.moveY = -4; } _loc1_._x += _loc1_.moveX; _loc1_._y += _loc1_.moveY; } if(_loc2_ == "getY") { _loc1_.destY = heli._y; if(_loc1_.dochange++ >= 100) { _loc1_.dochange = 0; _loc1_.destX = random(550); } if(_loc1_._y > _loc1_.destY) { _loc1_.moveY -= random(3) / 10; } if(_loc1_._y < _loc1_.destY) { _loc1_.moveY += random(3) / 10; } if(_loc1_._x > _loc1_.destX) { _loc1_.moveX -= random(3) / 10; } if(_loc1_._x < _loc1_.destX) { _loc1_.moveX += random(3) / 10; } if(_loc1_.moveX >= 4) { _loc1_.moveX = 4; } if(_loc1_.moveX <= -4) { _loc1_.moveX = -4; } if(_loc1_.moveY >= 4) { _loc1_.moveY = 4; } if(_loc1_.moveY <= -4) { _loc1_.moveY = -4; } _loc1_._x += _loc1_.moveX; _loc1_._y += _loc1_.moveY; } if(_loc2_ == "vehicle_random") { if(!_loc1_.destX) { _loc1_.destX = random(550); } if(_loc1_.dochange++ >= 100) { _loc1_.dochange = 0; _loc1_.destX = random(550); } if(_loc1_._x > _loc1_.destX) { _loc1_.moveX -= random(3) / 10; } if(_loc1_._x < _loc1_.destX) { _loc1_.moveX += random(3) / 10; } if(_loc1_.moveX >= 3) { _loc1_.moveX = 3; } if(_loc1_.moveX <= -3) { _loc1_.moveX = -3; } if(_loc1_.moveX < 0) { _loc1_.direction = "left"; } if(_loc1_.moveX >= 0) { _loc1_.direction = "right"; } _loc1_._x += _loc1_.moveX; } if(_loc2_ == "speedin") { if(_loc1_._x >= 550) { _loc1_.MoveX = -10; } else if(_loc1_.MoveX <= -4 && _loc1_._x > 200) { _loc1_.MoveX /= 1.06; } if(_loc1_.MoveX >= -10 && _loc1_._x <= 200) { _loc1_.MoveX *= 1.06; } _loc1_._x += _loc1_.MoveX; _loc1_._y = _loc1_.startPosY + 2 * Math.sin(_loc1_.r += 0.2); } if(_loc2_ == "speedin_slow") { if(_loc1_._x >= 550) { _loc1_.MoveX = -10; } else if(_loc1_.MoveX <= -2 && _loc1_._x > 200) { _loc1_.MoveX /= 1.06; } if(_loc1_.MoveX >= -5 && _loc1_._x <= 200) { _loc1_.MoveX *= 1.06; } _loc1_._x += _loc1_.MoveX; _loc1_._y = _loc1_.startPosY + 2 * Math.sin(_loc1_.r += 0.2); } if(_loc2_ == "divein") { if(direction == "right") { _loc1_._x += 5; } else { _loc1_._x -= 5; } if(_loc1_.path == "down") { _loc1_._y = _loc1_.startPosY - 10 * Math.sin(_loc1_.r += 0.1); } else { _loc1_._y = _loc1_.startPosY + 10 * Math.sin(_loc1_.r += 0.1); } } if(_loc2_ == "loop") { if(!_loc1_.phase) { _loc1_.thex += 0.2; _loc1_._y = 200 - Math.pow(_loc1_.thex,2) * 2; _loc1_._x = _loc1_.startPosX + _loc1_.thex * 5; if(_loc1_.thex >= 6) { _loc1_.phase = _loc1_.phase + 1; } } if(_loc1_.phase == 1) { _loc1_.movehow = "random"; } } } } } function moveMissile(which) { var _loc1_ = which; if(_loc1_._x <= 0 || _loc1_._x >= 550 || _loc1_._y >= 440 || _loc1_._y <= -30) { _loc1_.removeMovieClip(); } if(_loc1_.getNewTarget++ >= 10 && !_loc1_.seek._x) { _loc1_.getNewTarget = 0; _loc1_.seek = getClosestEnemy(_loc1_); } var _loc3_ = _loc1_.seek._x; var _loc2_ = _loc1_.seek._y; if(!_loc3_) { _loc3_ = 500; } if(!_loc2_) { _loc2_ = -50; } var z = _loc3_ - _loc1_._x; var r = _loc2_ - _loc1_._y; var a = z; var b = r; var e = z / r; var k = Math.atan(e); var g = k * 180 / 3.141592653589793; _loc1_._rotation = g; if(_loc2_ > _loc1_._y) { _loc1_._rotation = 90 - _loc1_._rotation; } else if(_loc2_ < _loc1_._y) { _loc1_._rotation = 180 - (_loc1_._rotation - 90); } _loc1_.step = _loc1_.step + 1; if(_loc1_._rotation != initAngle) { if(_loc1_.step <= 10) { _loc1_._rotation = 0; } var g = _loc1_._rotation * 0.01745; var z = Math.cos(g); var n = Math.sin(g); _loc1_._x += z * 10 + _loc1_.initSpeed; _loc1_._y += n * 10; _loc1_.initSpeed /= 1.04; if(_loc1_._x >= _loc3_ - 40 && _loc1_._x <= _loc3_ + 40 && _loc1_._y >= _loc2_ - 30 && _loc1_._y <= _loc2_ + 30) { _loc1_.seek.hitPoints -= _loc1_.damage; if(_loc1_.seek.hitPoints <= 0) { explode(_loc1_.seek,null,true); } else { flicker(_loc1_.seek); spark(_loc1_.seek); } _loc1_.removeMovieClip(); } } makeSmoke(_loc1_); } function makeSmoke(what) { if(drawsmoke) { var chooseSmoke = random(3) + 1; var chosenOne = eval("_root.cloud" + chooseSmoke); chosenOne.duplicateMovieClip("dupedSmoke_" + ++_root.cloudCount,_root.heli.o++); var dupedOne = eval("dupedSmoke_" + _root.cloudCount); var chosenSize = random(50) + 50; dupedOne._x = what.lastXpos; dupedOne._y = what.lastYpos; dupedOne._xscale = chosenSize; dupedOne._yscale = chosenSize; what.lastXpos = what._x; what.lastYpos = what._y; } } function rotate(what) { var _loc1_ = what; if(Key.isDown(39) || Key.isDown(40)) { if(_loc1_.flymode == "normal") { _loc1_.gotoAndPlay("rotate down"); } if(_loc1_.flymode == "undodown") { _loc1_.gotoAndPlay(_loc1_._currentframe - 25); } if(_loc1_.flymode == "undoup") { _loc1_.rotatethru = true; } } if(Key.isDown(37) || Key.isDown(38)) { if(_loc1_.flymode == "normal") { _loc1_.gotoAndPlay("rotate up"); } if(_loc1_.flymode == "undoup") { _loc1_.gotoAndPlay(_loc1_._currentframe - 33); } if(_loc1_.flymode == "undodown") { _loc1_.rotatethru = true; } } } function unrotate(what) { var _loc1_ = what; if(_loc1_.flymode == "bedown") { _loc1_.gotoAndPlay("goback down"); } if(_loc1_.flymode == "godown") { gotoFrame = 45 - (_loc1_._currentframe - 8); _loc1_.gotoAndPlay(gotoFrame); } if(_loc1_.flymode == "beup") { _loc1_.gotoAndPlay("goback up"); } if(_loc1_.flymode == "goup") { gotoFrame = 87 - (_loc1_._currentframe - 46); _loc1_.gotoAndPlay(gotoFrame); } } function cleanArray(input) { var _loc1_ = input; newarray = new Array(); _loc1_.sort(); l = 0; for(var _loc2_ in _loc1_) { if(_loc1_[_loc2_]._x) { newarray[++l] = _loc1_[_loc2_]; } } return newarray; }