Advertisement
Guest User

Untitled

a guest
Nov 29th, 2012
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package
  2. {
  3.  
  4.     import flash.display.MovieClip;
  5.     import flash.events.Event;
  6.     import flash.utils.Timer;
  7.     import flash.text.TextField;
  8.     import flash.events.MouseEvent;
  9.     import flash.text.TextFormat;
  10.     import flashx.textLayout.formats.BackgroundColor;
  11.     import flash.media.Sound;
  12.     import flash.media.SoundChannel;
  13.  
  14.  
  15.     public class Game extends MovieClip
  16.     {
  17.  
  18.         static var list:Array = new Array();
  19.         static var timesdied:Number;
  20.         static var gametimer:Number;
  21.         static var achtimer:Number;
  22.         static var ship:MovieClip;
  23.         static var enemyShipTimer:Timer;
  24.         static var specialShipTimer:Timer;
  25.         static var enemieskilled;
  26.         static var roundNumber:Number;
  27.         static var myTextField:TextField;
  28.         static var scoreText:TextField;
  29.         static var score:Number;
  30.         static var gameOverMenu:GameOverMenu;
  31.         static var mainMenu:MainMenu;
  32.         static var Background:Backgrounds;
  33.         static var shiphittests:MovieClip;
  34.         static var Paused:Boolean = false;
  35.         static var shopMenu:ShopMenu;
  36.         static var achMenu:AchMenu;
  37.         import flash.display.Sprite;
  38.         import flash.events.Event;
  39.         static var BulletLength:Number;
  40.         static var shrunk:Boolean = false;
  41.         static var grown:Boolean = false;
  42.         static var shieldactivate:Boolean = false;
  43.         static var doubleenemies:Boolean = false;
  44.         static var Instructions:instructions;
  45.         static var enemyShip2Timer:Timer;
  46.         static var enemyShip3Timer:Timer;
  47.         static var enemyShip4Timer:Timer;
  48.         static var enemyShip5Timer:Timer;
  49.         static var playthegameach:Boolean = false;//
  50.         static var asteroidkillerach:Boolean = false;//
  51.         static var asteroidkiller2ach:Boolean = false;//
  52.         static var asteroidkiller3ach:Boolean = false;//
  53.         static var asteroidkiller4ach:Boolean = false;//
  54.         static var a1minuteplayed:Boolean = false;//
  55.         static var a5minuteplayed:Boolean = false;//
  56.         static var a15minuteplayed:Boolean = false;//
  57.         static var a30minuteplayed:Boolean = false;//
  58.         static var a60minuteplayed:Boolean = false;//
  59.         static var died1time:Boolean = false;//
  60.         static var died10time:Boolean = false;//
  61.         static var died50time:Boolean = false;//
  62.         static var died100time:Boolean = false;//
  63.         static var teleported1time:Boolean = false;//
  64.         static var teleported100time:Boolean = false;//
  65.         static var teleported1000time:Boolean = false;//
  66.         static var randommax:Boolean = false;//
  67.         static var fireratemax:Boolean = false;//
  68.         static var shotpowermax:Boolean = false;//
  69.         static var shotdistancemax:Boolean = false;//
  70.         static var turnspeedmax:Boolean = false;//
  71.         static var brakesmax:Boolean = false;//
  72.         static var topspeedmax:Boolean = false;//
  73.         static var thrustmax:Boolean = false;//
  74.         static var duckyach:Boolean = false;//
  75.         static var nduckyach:Boolean = false;//
  76.         static var cantach:Boolean = false;//
  77.         static var tinyach:Boolean = false;//
  78.         static var miniach:Boolean = false;//
  79.         static var averageach:Boolean = false;//
  80.         static var largeach:Boolean = false;//
  81.         static var gigantoach:Boolean = false;//
  82.         static var mute1:Boolean = false;
  83.  
  84.         function togglemusic(e:Event)
  85.         {
  86.             if (mute1 == true)
  87.             {
  88.  
  89.                 bgChannel.stop();
  90.             }
  91.             else
  92.             {
  93.                 bgChannel.play();
  94.             }
  95.         }
  96.         function Game()
  97.         {
  98.             if (Game.Paused == false)
  99.             {
  100.  
  101.  
  102.                 var bgm:Sound = new bgmusic();
  103.                 var bgChannel:SoundChannel = new SoundChannel();
  104.                 bgChannel = bgm.play();
  105.  
  106.  
  107.                 timesdied = 0;
  108.                 gametimer = 0;
  109.                 achtimer = 0;
  110.                 enemieskilled = 0;
  111.                 BulletLength = 1;
  112.  
  113.                 Key.initialize(stage);
  114.  
  115.                 ship = new Ship();
  116.                 ship.x = 300;
  117.                 ship.y = 150;
  118.  
  119.                 Background = new Backgrounds();
  120.  
  121.                 addChild(Background);
  122.                 ship.visible = false;
  123.                 addChild(ship);
  124.                 myTextField= new TextField();
  125.                 addChild(myTextField);
  126.                 if (doubleenemies == false)
  127.                 {
  128.                     enemyShipTimer = new Timer(2000);
  129.  
  130.                 }
  131.                 if (doubleenemies == true)
  132.                 {
  133.                     enemyShipTimer = new Timer(1000);
  134.                 }
  135.                 enemyShipTimer.addEventListener("timer", sendEnemy);
  136.                 enemyShipTimer.stop();
  137.  
  138.                 if (doubleenemies == false)
  139.                 {
  140.                     enemyShip2Timer = new Timer(2000);
  141.  
  142.                 }
  143.                 if (doubleenemies == true)
  144.                 {
  145.                     enemyShip2Timer = new Timer(1000);
  146.                 }
  147.                 enemyShip2Timer.addEventListener("timer", sendEnemy2);
  148.                 enemyShip2Timer.stop();
  149.  
  150.                 if (doubleenemies == false)
  151.                 {
  152.                     enemyShip3Timer = new Timer(2000);
  153.  
  154.                 }
  155.                 if (doubleenemies == true)
  156.                 {
  157.                     enemyShip3Timer = new Timer(1000);
  158.                 }
  159.                 enemyShip3Timer.addEventListener("timer", sendEnemy3);
  160.                 enemyShip3Timer.stop();
  161.                 if (doubleenemies == false)
  162.                 {
  163.                     enemyShip4Timer = new Timer(4000);
  164.  
  165.                 }
  166.                 if (doubleenemies == true)
  167.                 {
  168.                     enemyShip4Timer = new Timer(2000);
  169.                 }
  170.                 enemyShip4Timer.addEventListener("timer", sendEnemy4);
  171.                 enemyShip4Timer.stop();
  172.                 if (doubleenemies == false)
  173.                 {
  174.                     enemyShip5Timer = new Timer(12000);
  175.  
  176.                 }
  177.                 if (doubleenemies == true)
  178.                 {
  179.                     enemyShip5Timer = new Timer(6000);
  180.                 }
  181.                 enemyShip5Timer.addEventListener("timer", sendEnemy5);
  182.                 enemyShip5Timer.stop();
  183.  
  184.                 if (doubleenemies == false)
  185.                 {
  186.  
  187.                     specialShipTimer = new Timer(1000);
  188.                 }
  189.                 if (doubleenemies == true)
  190.                 {
  191.                     specialShipTimer = new Timer(500);
  192.                 }
  193.                 specialShipTimer.addEventListener("timer", sendspecialEnemy);
  194.                 specialShipTimer.stop();
  195.  
  196.                 myTextField.text = String('');
  197.                 myTextField.width = 2500;
  198.                 myTextField.x = 25;
  199.                 myTextField.selectable = false;
  200.                 myTextField.y = 25;
  201.                 scoreText = new TextField();
  202.                 scoreText.x = 290;
  203.                 scoreText.y = 25;
  204.                 scoreText.text = String(0);
  205.                 addChild(scoreText);
  206.  
  207.                 resetScore();
  208.                 gameOverMenu = new GameOverMenu();
  209.  
  210.  
  211.                 addChild(gameOverMenu);
  212.                 gameOverMenu.visible = false;
  213.                 gameOverMenu.playAgainButton.addEventListener("mouseDown", showmainmenu);
  214.                 mainMenu = new MainMenu();
  215.                 addChild(mainMenu);
  216.                 mainMenu.visible = true;
  217.                 mainMenu.x = 300;
  218.                 mainMenu.y = 300;
  219.                 mainMenu.startButton.addEventListener("mouseDown", newGame);
  220.                 mainMenu.achButton.addEventListener("mouseDown", showAch);
  221.                 mainMenu.shopButton.addEventListener("mouseDown", showShop);
  222.                 mainMenu.instructbutton.addEventListener("mouseDown", showInstruct);
  223.  
  224.                 shopMenu = new ShopMenu();
  225.                 achMenu = new AchMenu();
  226.  
  227.                 addChild(achMenu);
  228.                 Instructions = new instructions();
  229.                 addChild(Instructions);
  230.                 addChild(shopMenu);
  231.                 Instructions.visible = false;
  232.                 Instructions.x = 240;
  233.                 Instructions.y = 240;
  234.                 achMenu.visible = false;
  235.                 achMenu.x = 220;
  236.                 achMenu.y = 300;
  237.                 shopMenu.visible = false;
  238.                 shopMenu.x = 240;
  239.                 shopMenu.y = 240;
  240.                 achMenu.backbut.addEventListener("mouseDown", showmainmenu);
  241.  
  242.                 shopMenu.BackButton.addEventListener("mouseDown", showmainmenu);
  243.                 shopMenu.ShieldButton.Upgrade.gotoAndStop(1);
  244.                 shopMenu.ThrustButton.Upgrade.gotoAndStop(1);
  245.                 shopMenu.BulletLengthButton.Upgrade.gotoAndStop(1);
  246.                 shopMenu.FireRateButton.Upgrade.gotoAndStop(1);
  247.                 shopMenu.BrakesButton.Upgrade.gotoAndStop(1);
  248.                 shopMenu.TopSpeedButton.Upgrade.gotoAndStop(1);
  249.                 shopMenu.TurnSpeedButton.Upgrade.gotoAndStop(1);
  250.                 shopMenu.NumberOfShotsButton.Upgrade.gotoAndStop(1);
  251.  
  252.                 mainMenu.hardmodebox.addEventListener("mouseDown", togglehardmode);
  253.                 shopMenu.ShieldButton.addEventListener("mouseDown", UpgradeShield);
  254.                 shopMenu.ThrustButton.addEventListener("mouseDown", UpgradeThrust);
  255.                 shopMenu.BulletLengthButton.addEventListener("mouseDown", UpgradeBulletLength);
  256.                 shopMenu.FireRateButton.addEventListener("mouseDown", UpgradeFireRate);
  257.                 shopMenu.BrakesButton.addEventListener("mouseDown", UpgradeBrakes);
  258.                 shopMenu.TopSpeedButton.addEventListener("mouseDown", UpgradeTopSpeed);
  259.                 shopMenu.TurnSpeedButton.addEventListener("mouseDown", UpgradeTurnSpeed);
  260.                 shopMenu.NumberOfShotsButton.addEventListener("mouseDown", UpgradeNumberOfShots);
  261.  
  262.                 shopMenu.ShieldButton.addEventListener(MouseEvent.ROLL_OVER, ShieldButtonCost);
  263.                 shopMenu.ShieldButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
  264.                 shopMenu.ThrustButton.addEventListener(MouseEvent.ROLL_OVER, ThrustButtonCost);
  265.                 shopMenu.ThrustButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
  266.                 shopMenu.BulletLengthButton.addEventListener(MouseEvent.ROLL_OVER, BulletLengthButtonCost);
  267.                 shopMenu.BulletLengthButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
  268.                 shopMenu.FireRateButton.addEventListener(MouseEvent.ROLL_OVER, FireRateButtonCost);
  269.                 shopMenu.FireRateButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
  270.                 shopMenu.BrakesButton.addEventListener(MouseEvent.ROLL_OVER, BrakesButtonCost);
  271.                 shopMenu.BrakesButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
  272.                 shopMenu.TopSpeedButton.addEventListener(MouseEvent.ROLL_OVER, TopSpeedButtonCost);
  273.                 shopMenu.TopSpeedButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
  274.                 shopMenu.TurnSpeedButton.addEventListener(MouseEvent.ROLL_OVER, TurnSpeedButtonCost);
  275.                 shopMenu.TurnSpeedButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
  276.                 shopMenu.NumberOfShotsButton.addEventListener(MouseEvent.ROLL_OVER, NumberOfShotsButtonCost);
  277.                 shopMenu.NumberOfShotsButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
  278.                 mainMenu.ShipMode.addEventListener("mouseDown", toggleshipmode);
  279.                 Instructions.instructionsbutton.addEventListener("mouseDown", instructback);
  280.                 var scoreFormat = new TextFormat("Joystix",10,0x663300);
  281.                 var scoreFormat2 = new TextFormat("Joystix",15,0x663300);
  282.                 myTextField.defaultTextFormat = scoreFormat;
  283.                 scoreText.defaultTextFormat = scoreFormat2;
  284.             }
  285.         }
  286.  
  287.         function instructback(e:Event)
  288.         {
  289.             Instructions.visible = false;
  290.             mainMenu.visible = true;
  291.         }
  292.         function toggleshipmode(e:Event)
  293.         {
  294.             if (ship.ShieldPower > 4)
  295.             {
  296.                 if (ship.isduck == false)
  297.                 {
  298.                     mainMenu.ShipMode.gotoAndStop(3);
  299.                     ship.isduck = true;
  300.  
  301.                 }
  302.                 else
  303.                 {
  304.                     mainMenu.ShipMode.gotoAndStop(2);
  305.                     ship.isduck = false;
  306.  
  307.                 }
  308.             }
  309.  
  310.         }
  311.         function togglehardmode(e:Event)
  312.         {
  313.             if (ship.ShieldPower > 6)
  314.             {
  315.                 if (doubleenemies == false)
  316.                 {
  317.                     mainMenu.hardmodebox.gotoAndStop(3);
  318.                     doubleenemies = true;
  319.                     trace('banana');
  320.  
  321.                 }
  322.                 else
  323.                 {
  324.                     mainMenu.hardmodebox.gotoAndStop(2);
  325.                     doubleenemies = false;
  326.  
  327.                 }
  328.             }
  329.         }
  330.         function ShieldButtonCost(e:Event)
  331.         {
  332.  
  333.             shopMenu.BackButton.UpgradeText.visible = true;
  334.             shopMenu.BackButton.UpgradeText.text = 1000 * ship.ShieldPower;
  335.         }
  336.         function ThrustButtonCost(e:Event)
  337.         {
  338.             shopMenu.BackButton.UpgradeText.visible = true;
  339.             shopMenu.BackButton.UpgradeText.text = 500 * ship.thrustVar;
  340.         }
  341.         function BulletLengthButtonCost(e:Event)
  342.         {
  343.             shopMenu.BackButton.UpgradeText.visible = true;
  344.             shopMenu.BackButton.UpgradeText.text = 750 * BulletLength;
  345.         }
  346.         function FireRateButtonCost(e:Event)
  347.         {
  348.             shopMenu.BackButton.UpgradeText.visible = true;
  349.             shopMenu.BackButton.UpgradeText.text = 750 * ship.shootTimerVar;
  350.         }
  351.         function BrakesButtonCost(e:Event)
  352.         {
  353.             shopMenu.BackButton.UpgradeText.visible = true;
  354.             shopMenu.BackButton.UpgradeText.text = 500 * ship.brakesVar;
  355.         }
  356.         function TopSpeedButtonCost(e:Event)
  357.         {
  358.             shopMenu.BackButton.UpgradeText.visible = true;
  359.             shopMenu.BackButton.UpgradeText.text = 500 * ship.topSpeedVar;
  360.         }
  361.         function TurnSpeedButtonCost(e:Event)
  362.         {
  363.             shopMenu.BackButton.UpgradeText.visible = true;
  364.             shopMenu.BackButton.UpgradeText.text = 500 * ship.turnSpeedVar;
  365.         }
  366.  
  367.         function NumberOfShotsButtonCost(e:Event)
  368.         {
  369.             shopMenu.BackButton.UpgradeText.visible = true;
  370.             shopMenu.BackButton.UpgradeText.text = 1000 * ship.numberOfBulletsVar;
  371.         }
  372.         function CostReset(e:Event)
  373.         {
  374.  
  375.             shopMenu.BackButton.UpgradeText.visible = false;
  376.         }
  377.  
  378.         static function gameOver()
  379.         {
  380.             timesdied +=  1;
  381.             if (timesdied == 1)
  382.             {
  383.                 if (died1time == false)
  384.                 {
  385.                     updateach("Achievement Unlocked: Die");
  386.                     updateScore(50);
  387.                     died1time = true;
  388.                     achMenu.die.gotoAndStop(2);
  389.                 }
  390.             }
  391.             if (timesdied == 10)
  392.             {
  393.                 if (died1time == false)
  394.                 {
  395.                     updateach("Achievement Unlocked: Persistent");
  396.                     updateScore(50);
  397.                     died10time = true;
  398.                     achMenu.pers.gotoAndStop(2);
  399.                 }
  400.             }
  401.             if (timesdied == 50)
  402.             {
  403.                 if (died1time == false)
  404.                 {
  405.                     updateach("Achievement Unlocked: Just keep dieing");
  406.                     updateScore(50);
  407.                     died50time = true;
  408.                     achMenu.just.gotoAndStop(2);
  409.                 }
  410.             }
  411.             if (timesdied == 100)
  412.             {
  413.                 if (died1time == false)
  414.                 {
  415.                     updateach("Achievement Unlocked: Suicidal");
  416.                     updateScore(50);
  417.                     died100time = true;
  418.                     achMenu.suic.gotoAndStop(2);
  419.                 }
  420.             }
  421.             gameOverMenu.visible = true;
  422.             gameOverMenu.x = 300;
  423.             gameOverMenu.y = 300;
  424.             enemyShipTimer.stop();
  425.             enemyShip2Timer.stop();
  426.             enemyShip3Timer.stop();
  427.             enemyShip4Timer.stop();
  428.             enemyShip5Timer.stop();
  429.             specialShipTimer.stop();
  430.             ship.Round = 0;
  431.  
  432.             for (var i in list)
  433.             {
  434.                 list[i].gameoverdie();
  435.             }
  436.  
  437.         }
  438.  
  439.         function showmainmenu(e:Event)
  440.         {
  441.             shopMenu.visible = false;
  442.             achMenu.visible = false;
  443.             mainMenu.visible = true;
  444.             gameOverMenu.visible = false;
  445.         }
  446.  
  447.         function newGame(e:Event)
  448.         {
  449.             if (playthegameach == false)
  450.             {
  451.                 updateach("Achievement Unlocked:Play the game");
  452.                 playthegameach = true;
  453.                 updateScore(50);
  454.                 achMenu.welc.gotoAndStop(2);
  455.             }
  456.             ship.changemode();
  457.             mainMenu.visible = false;
  458.             gameOverMenu.visible = false;
  459.             ship.visible = true;
  460.             ship.x = 300;
  461.             ship.y = 300;
  462.             ship.thrust = 0;
  463.             ship.addEventListener("enterFrame", ship.move);
  464.  
  465.             ship.Round = 1;
  466.  
  467.             specialShipTimer.start();
  468.             ship.invulnTimer = 0;
  469.             ship.invulnUsed = false;
  470.  
  471.  
  472.         }
  473.         function showShop(e:Event)
  474.         {
  475.             mainMenu.visible = false;
  476.             shopMenu.visible = true;
  477.         }
  478.         function showAch(e:Event)
  479.         {
  480.             mainMenu.visible = false;
  481.             achMenu.visible = true;
  482.         }
  483.         function showInstruct(e:Event)
  484.         {
  485.             mainMenu.visible = false;
  486.             Instructions.visible = true;
  487.         }
  488.         function showMainMenu(e:Event)
  489.         {
  490.             mainMenu.visible = true;
  491.             shopMenu.visible = false;
  492.         }
  493.         function sendEnemy(e:Event)
  494.         {
  495.             var enemy = new EnemyShip();
  496.             stage.addChild(enemy);
  497.  
  498.  
  499.         }
  500.         function sendEnemy2(e:Event)
  501.         {
  502.             var enemy2 = new EnemyShip2();
  503.             stage.addChild(enemy2);
  504.  
  505.         }
  506.         function sendEnemy3(e:Event)
  507.         {
  508.             var enemy3 = new EnemyShip3();
  509.             stage.addChild(enemy3);
  510.  
  511.         }
  512.         function sendEnemy4(e:Event)
  513.         {
  514.             var enemy4 = new EnemyShip4();
  515.             stage.addChild(enemy4);
  516.  
  517.         }
  518.         function sendEnemy5(e:Event)
  519.         {
  520.             var enemy5 = new EnemyShip5();
  521.             stage.addChild(enemy5);
  522.  
  523.         }
  524.         function sendspecialEnemy(e:Event)
  525.         {
  526.  
  527.             if (Math.random() < .001 && ship.ShieldPower > 8)
  528.             {
  529.                 var special = new SpecialShip();
  530.                 stage.addChild(special);
  531.             }
  532.         }
  533.         static function updateScore(points)
  534.         {
  535.             score +=  points;
  536.             scoreText.text = String(score);
  537.         }
  538.         static function updateach(ach)
  539.         {
  540.             achtimer = 0;
  541.             myTextField.text = String(ach);
  542.         }
  543.  
  544.         static function resetScore()
  545.         {
  546.             score = 0;
  547.             scoreText.text = String(score);
  548.  
  549.         }
  550.         function UpgradeShield(e:Event)
  551.         {
  552.             trace('banana');
  553.             if (ship.ShieldPower == 5)
  554.             {
  555.                 mainMenu.ShipMode.gotoAndStop(2);
  556.             }
  557.             if (ship.ShieldPower > 6)
  558.             {
  559.                 mainMenu.hardmodebox.gotoAndStop(2);
  560.             }
  561.             if (Game.ship.ShieldPower < 11)
  562.             {
  563.                 if (1000 * Game.ship.ShieldPower <= score)
  564.                 {
  565.  
  566.                     if (Game.ship.ShieldPower == 10)
  567.                     {
  568.                         if (randommax == false)
  569.                         {
  570.                             randommax = true;
  571.                             updateach("Achievement Unlocked: Randomizer, Cant Touch This");
  572.                             updateScore(100);
  573.                             randommax = true;
  574.                             achMenu.rand.gotoAndStop(2);
  575.                             achMenu.cant.gotoAndStop(2);
  576.                         }
  577.  
  578.                     }
  579.                     updateScore(-1000*ship.ShieldPower);
  580.                     Game.ship.ShieldPower +=  1;
  581.                     shopMenu.ShieldButton.Upgrade.gotoAndStop(ship.ShieldPower);
  582.                     shopMenu.BackButton.UpgradeText.text = 1000 * ship.ShieldPower;
  583.                 }
  584.             }
  585.         }
  586.         function UpgradeThrust(e:Event)
  587.         {
  588.  
  589.             if (500 * Game.ship.thrustVar <= score)
  590.             {
  591.                 if (Game.ship.thrustVar == 10)
  592.                 {
  593.                     if (thrustmax == false)
  594.                     {
  595.                         thrustmax = true;
  596.                         updateach("Achievement Unlocked: Thrusters Primed");
  597.                         updateScore(50);
  598.                         thrustmax = true;
  599.                         achMenu.thru.gotoAndStop(2);
  600.                     }
  601.  
  602.                 }
  603.                 if (Game.ship.thrustVar < 11)
  604.                 {
  605.                     updateScore(-500*ship.thrustVar);
  606.                     Game.ship.thrustVar +=  1;
  607.                     shopMenu.ThrustButton.Upgrade.gotoAndStop(ship.thrustVar);
  608.                     shopMenu.BackButton.UpgradeText.text = 500 * ship.thrustVar;
  609.                 }
  610.             }
  611.         }
  612.         function UpgradeFireRate(e:Event)
  613.         {
  614.  
  615.             if (750 * Game.ship.shootTimerVar <= score)
  616.             {
  617.                 if (Game.ship.shootTimerVar == 10)
  618.                 {
  619.                     if (fireratemax == false)
  620.                     {
  621.                         fireratemax = true;
  622.                         updateach("Achievement Unlocked: QuickDraw");
  623.                         updateScore(50);
  624.                         fireratemax = true;
  625.                         achMenu.quic.gotoAndStop(2);
  626.                     }
  627.  
  628.                 }
  629.                 if (ship.shootTimerVar < 11)
  630.                 {
  631.                     updateScore(-750*ship.shootTimerVar);
  632.                     Game.ship.shootTimerVar +=  1;
  633.                     shopMenu.FireRateButton.Upgrade.gotoAndStop(ship.shootTimerVar);
  634.                     shopMenu.BackButton.UpgradeText.text = 750 * ship.shootTimerVar;
  635.                 }
  636.             }
  637.  
  638.         }
  639.  
  640.         function UpgradeBulletLength(e:Event)
  641.         {
  642.  
  643.             if (750 * BulletLength <= score)
  644.             {
  645.                 if (BulletLength == 10)
  646.                 {
  647.                     if (shotdistancemax == false)
  648.                     {
  649.                         shotdistancemax = true;
  650.                         updateach("Achievement Unlocked: Sniper");
  651.                         updateScore(50);
  652.                         shotdistancemax = true;
  653.                         achMenu.snip.gotoAndStop(2);
  654.                     }
  655.  
  656.                 }
  657.                 if (BulletLength < 11)
  658.                 {
  659.                     updateScore(-750*BulletLength);
  660.                     BulletLength +=  1;
  661.                     shopMenu.BulletLengthButton.Upgrade.gotoAndStop(BulletLength);
  662.                     shopMenu.BackButton.UpgradeText.text = 750 * BulletLength;
  663.  
  664.                 }
  665.             }
  666.  
  667.         }
  668.         function UpgradeBrakes(e:Event)
  669.         {
  670.  
  671.             if (500 * Game.ship.brakesVar <= score)
  672.             {
  673.                 if (Game.ship.brakesVar == 10)
  674.                 {
  675.                     if (brakesmax == false)
  676.                     {
  677.                         brakesmax = true;
  678.                         updateach("Achievement Unlocked: STOP!");
  679.                         updateScore(50);
  680.                         brakesmax = true;
  681.                         achMenu.brak.gotoAndStop(2);
  682.                     }
  683.  
  684.                 }
  685.                 if (Game.ship.brakesVar < 11)
  686.                 {
  687.                     updateScore(-500*ship.brakesVar);
  688.                     Game.ship.brakesVar +=  1;
  689.                     shopMenu.BrakesButton.Upgrade.gotoAndStop(Game.ship.brakesVar);
  690.                     shopMenu.BackButton.UpgradeText.text = 500 * ship.brakesVar;
  691.                 }
  692.             }
  693.  
  694.         }
  695.         function UpgradeTopSpeed(e:Event)
  696.         {
  697.             if (500 * Game.ship.topSpeedVar <= score)
  698.             {
  699.                 if (Game.ship.topSpeedVar == 10)
  700.                 {
  701.                     if (topspeedmax == false)
  702.                     {
  703.                         topspeedmax = true;
  704.                         updateach("Achievement Unlocked: Super Fast");
  705.                         updateScore(50);
  706.                         topspeedmax = true;
  707.                         achMenu.tops.gotoAndStop(2);
  708.                     }
  709.  
  710.                 }
  711.                 if (Game.ship.topSpeedVar < 11)
  712.                 {
  713.                     updateScore(-500*ship.topSpeedVar);
  714.                     Game.ship.topSpeedVar +=  1;
  715.                     shopMenu.TopSpeedButton.Upgrade.gotoAndStop(Game.ship.topSpeedVar);
  716.                     shopMenu.BackButton.UpgradeText.text = 500 * ship.topSpeedVar;
  717.                 }
  718.             }
  719.  
  720.         }
  721.         function UpgradeTurnSpeed(e:Event)
  722.         {
  723.             if (500 * Game.ship.turnSpeedVar <= score)
  724.             {
  725.                 if (Game.ship.turnSpeedVar == 10)
  726.                 {
  727.                     if (turnspeedmax == false)
  728.                     {
  729.                         turnspeedmax = true;
  730.                         updateach("Achievement Unlocked: Spin Spin Spin");
  731.                         updateScore(50);
  732.                         turnspeedmax = true;
  733.                         achMenu.turn.gotoAndStop(2);
  734.                     }
  735.  
  736.                 }
  737.                 if (ship.turnSpeedVar < 11)
  738.                 {
  739.                     updateScore(-500*ship.turnSpeedVar);
  740.                     Game.ship.turnSpeedVar +=  1;
  741.                     shopMenu.TurnSpeedButton.Upgrade.gotoAndStop(Game.ship.turnSpeedVar);
  742.                     shopMenu.BackButton.UpgradeText.text = 500 * ship.turnSpeedVar;
  743.                 }
  744.             }
  745.  
  746.         }
  747.         function UpgradeNumberOfShots(e:Event)
  748.         {
  749.             if (1000 * Game.ship.numberOfBulletsVar <= score)
  750.             {
  751.                 if (Game.ship.numberOfBulletsVar == 10)
  752.                 {
  753.                     if (shotpowermax == false)
  754.                     {
  755.                         shotpowermax = true;
  756.                         updateach("Achievement Unlocked: Shoot EVERYTHING!");
  757.                         updateScore(50);
  758.                         shotpowermax = true;
  759.                         achMenu.shot.gotoAndStop(2);
  760.                     }
  761.  
  762.                 }
  763.                 if (Game.ship.numberOfBulletsVar < 11)
  764.                 {
  765.                     updateScore(-1000*ship.numberOfBulletsVar);
  766.                     Game.ship.numberOfBulletsVar +=  1;
  767.                     shopMenu.NumberOfShotsButton.Upgrade.gotoAndStop(ship.numberOfBulletsVar);
  768.                     shopMenu.BackButton.UpgradeText.text = 1000 * ship.numberOfBulletsVar;
  769.                 }
  770.             }
  771.  
  772.         }
  773.  
  774.     }
  775.  
  776. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement