Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import flash.net.SharedObject;
- import flash.display.MovieClip;
- import flash.events.Event;
- import flash.utils.Timer;
- import flash.text.TextField;
- import flash.events.MouseEvent;
- import flash.text.TextFormat;
- import flashx.textLayout.formats.BackgroundColor;
- import flash.media.Sound;
- import flash.media.SoundChannel;
- public class Game extends MovieClip
- {
- public static var savedData:SharedObject;
- static var list:Array = new Array();
- static var timesdied:Number;
- static var gametimer:Number;
- static var achtimer:Number;
- static var soundbutton:MovieClip;
- static var ship:MovieClip;
- static var enemyShipTimer:Timer;
- static var specialShipTimer:Timer;
- static var enemieskilled;
- static var roundNumber:Number;
- static var myTextField:TextField;
- static var scoreText:TextField;
- static var score:Number;
- static var gameOverMenu:GameOverMenu;
- static var mainMenu:MainMenu;
- static var Story:story;
- static var Background:Backgrounds;
- static var shiphittests:MovieClip;
- static var Paused:Boolean = false;
- static var shopMenu:ShopMenu;
- static var achMenu:AchMenu;
- static var BulletLength:Number;
- static var shrunk:Boolean = false;
- static var grown:Boolean = false;
- static var shieldactivate:Boolean = false;
- static var doubleenemies:Boolean = false;
- static var Instructions:instructions;
- static var enemyShip2Timer:Timer;
- static var enemyShip3Timer:Timer;
- static var enemyShip4Timer:Timer;
- static var enemyShip5Timer:Timer;
- static var playthegameach:Boolean = false;//
- static var asteroidkillerach:Boolean = false;//
- static var asteroidkiller2ach:Boolean = false;//
- static var asteroidkiller3ach:Boolean = false;//
- static var asteroidkiller4ach:Boolean = false;//
- static var a1minuteplayed:Boolean = false;//
- static var a5minuteplayed:Boolean = false;//
- static var a15minuteplayed:Boolean = false;//
- static var a30minuteplayed:Boolean = false;//
- static var a60minuteplayed:Boolean = false;//
- static var died1time:Boolean = false;//
- static var died10time:Boolean = false;//
- static var died50time:Boolean = false;//
- static var died100time:Boolean = false;//
- static var teleported1time:Boolean = false;//
- static var teleported100time:Boolean = false;//
- static var teleported1000time:Boolean = false;//
- static var randommax:Boolean = false;//
- static var fireratemax:Boolean = false;//
- static var shotpowermax:Boolean = false;//
- static var shotdistancemax:Boolean = false;//
- static var turnspeedmax:Boolean = false;//
- static var brakesmax:Boolean = false;//
- static var topspeedmax:Boolean = false;//
- static var thrustmax:Boolean = false;//
- static var duckyach:Boolean = false;//
- static var nduckyach:Boolean = false;//
- static var cantach:Boolean = false;//
- static var tinyach:Boolean = false;//
- static var miniach:Boolean = false;//
- static var averageach:Boolean = false;//
- static var largeach:Boolean = false;//
- static var gigantoach:Boolean = false;//
- function Game()
- {
- if (Game.Paused == false)
- {
- Key.initialize(stage);
- ship = new Ship();
- ship.x = 200;
- ship.y = 150;
- soundbutton = new soundButton();
- soundbutton.x = 650;
- soundbutton.y = 120;
- Background = new Backgrounds();
- addChild(Background);
- ship.visible = false;
- addChild(soundbutton);
- addChild(ship);
- myTextField= new TextField();
- addChild(myTextField);
- if (doubleenemies == false)
- {
- enemyShipTimer = new Timer(2000);
- }
- if (doubleenemies == true)
- {
- enemyShipTimer = new Timer(1000);
- }
- enemyShipTimer.addEventListener("timer", sendEnemy);
- enemyShipTimer.stop();
- if (doubleenemies == false)
- {
- enemyShip2Timer = new Timer(2000);
- }
- if (doubleenemies == true)
- {
- enemyShip2Timer = new Timer(1000);
- }
- enemyShip2Timer.addEventListener("timer", sendEnemy2);
- enemyShip2Timer.stop();
- if (doubleenemies == false)
- {
- enemyShip3Timer = new Timer(2000);
- }
- if (doubleenemies == true)
- {
- enemyShip3Timer = new Timer(1000);
- }
- enemyShip3Timer.addEventListener("timer", sendEnemy3);
- enemyShip3Timer.stop();
- if (doubleenemies == false)
- {
- enemyShip4Timer = new Timer(4000);
- }
- if (doubleenemies == true)
- {
- enemyShip4Timer = new Timer(2000);
- }
- enemyShip4Timer.addEventListener("timer", sendEnemy4);
- enemyShip4Timer.stop();
- if (doubleenemies == false)
- {
- enemyShip5Timer = new Timer(12000);
- }
- if (doubleenemies == true)
- {
- enemyShip5Timer = new Timer(6000);
- }
- enemyShip5Timer.addEventListener("timer", sendEnemy5);
- enemyShip5Timer.stop();
- if (doubleenemies == false)
- {
- specialShipTimer = new Timer(1000);
- }
- if (doubleenemies == true)
- {
- specialShipTimer = new Timer(500);
- }
- specialShipTimer.addEventListener("timer", sendspecialEnemy);
- specialShipTimer.stop();
- myTextField.text = String('');
- myTextField.width = 2500;
- myTextField.x = 25;
- myTextField.selectable = false;
- myTextField.y = 25;
- scoreText = new TextField();
- scoreText.x = 290;
- scoreText.y = 25;
- scoreText.text = String(0);
- addChild(scoreText);
- resetScore();
- gameOverMenu = new GameOverMenu();
- addChild(gameOverMenu);
- gameOverMenu.visible = false;
- gameOverMenu.playAgainButton.addEventListener("mouseDown", showmainmenu);
- gameOverMenu.playAgainButton.addEventListener("mouseDown", save);
- gameOverMenu.playAgainButton.addEventListener("mouseDown", ship.saveg);
- mainMenu = new MainMenu();
- addChild(mainMenu);
- mainMenu.visible = true;
- mainMenu.x = 300;
- mainMenu.y = 300;
- Story = new story();
- addChild(Story);
- Story.visible = false;
- Story.x = 300;
- Story.y = 500;
- mainMenu.startButton.addEventListener("mouseDown", newGame);
- mainMenu.achButton.addEventListener("mouseDown", showAch);
- mainMenu.shopButton.addEventListener("mouseDown", showShop);
- mainMenu.instructbutton.addEventListener("mouseDown", showInstruct);
- mainMenu.storybox.addEventListener("mouseDown", togglestory);
- shopMenu = new ShopMenu();
- achMenu = new AchMenu();
- addChild(achMenu);
- Instructions = new instructions();
- addChild(Instructions);
- addChild(shopMenu);
- Instructions.visible = false;
- Instructions.x = 240;
- Instructions.y = 240;
- achMenu.visible = false;
- achMenu.x = 220;
- achMenu.y = 300;
- shopMenu.visible = false;
- shopMenu.x = 240;
- shopMenu.y = 240;
- achMenu.backbut.addEventListener("mouseDown", showmainmenu);
- shopMenu.BackButton.addEventListener("mouseDown", showmainmenu);
- shopMenu.BackButton.addEventListener("mouseDown", save);
- shopMenu.BackButton.addEventListener("mouseDown", ship.saveg);
- shopMenu.ShieldButton.Upgrade.gotoAndStop(1);
- shopMenu.ThrustButton.Upgrade.gotoAndStop(1);
- shopMenu.BulletLengthButton.Upgrade.gotoAndStop(1);
- shopMenu.FireRateButton.Upgrade.gotoAndStop(1);
- shopMenu.BrakesButton.Upgrade.gotoAndStop(1);
- shopMenu.TopSpeedButton.Upgrade.gotoAndStop(1);
- shopMenu.TurnSpeedButton.Upgrade.gotoAndStop(1);
- shopMenu.NumberOfShotsButton.Upgrade.gotoAndStop(1);
- mainMenu.hardmodebox.addEventListener("mouseDown", togglehardmode);
- shopMenu.ShieldButton.addEventListener("mouseDown", UpgradeShield);
- shopMenu.ThrustButton.addEventListener("mouseDown", UpgradeThrust);
- shopMenu.BulletLengthButton.addEventListener("mouseDown", UpgradeBulletLength);
- shopMenu.FireRateButton.addEventListener("mouseDown", UpgradeFireRate);
- shopMenu.BrakesButton.addEventListener("mouseDown", UpgradeBrakes);
- shopMenu.TopSpeedButton.addEventListener("mouseDown", UpgradeTopSpeed);
- shopMenu.TurnSpeedButton.addEventListener("mouseDown", UpgradeTurnSpeed);
- shopMenu.NumberOfShotsButton.addEventListener("mouseDown", UpgradeNumberOfShots);
- shopMenu.ShieldButton.addEventListener(MouseEvent.ROLL_OVER, ShieldButtonCost);
- shopMenu.ShieldButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
- shopMenu.ThrustButton.addEventListener(MouseEvent.ROLL_OVER, ThrustButtonCost);
- shopMenu.ThrustButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
- shopMenu.BulletLengthButton.addEventListener(MouseEvent.ROLL_OVER, BulletLengthButtonCost);
- shopMenu.BulletLengthButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
- shopMenu.FireRateButton.addEventListener(MouseEvent.ROLL_OVER, FireRateButtonCost);
- shopMenu.FireRateButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
- shopMenu.BrakesButton.addEventListener(MouseEvent.ROLL_OVER, BrakesButtonCost);
- shopMenu.BrakesButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
- shopMenu.TopSpeedButton.addEventListener(MouseEvent.ROLL_OVER, TopSpeedButtonCost);
- shopMenu.TopSpeedButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
- shopMenu.TurnSpeedButton.addEventListener(MouseEvent.ROLL_OVER, TurnSpeedButtonCost);
- shopMenu.TurnSpeedButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
- shopMenu.NumberOfShotsButton.addEventListener(MouseEvent.ROLL_OVER, NumberOfShotsButtonCost);
- shopMenu.NumberOfShotsButton.addEventListener(MouseEvent.ROLL_OUT, CostReset);
- mainMenu.ShipMode.addEventListener("mouseDown", toggleshipmode);
- Instructions.instructionsbutton.addEventListener("mouseDown", instructback);
- var scoreFormat = new TextFormat("Joystix",10,0x663300);
- var scoreFormat2 = new TextFormat("Joystix",15,0x663300);
- myTextField.defaultTextFormat = scoreFormat;
- scoreText.defaultTextFormat = scoreFormat2;
- savedData = SharedObject.getLocal("newtest7");
- if (savedData.data.timesdied == undefined)
- {
- timesdied = 0;
- gametimer = 0;
- achtimer = 0;
- enemieskilled = 0;
- BulletLength = 1;
- score = 0;
- }
- else
- {
- score = savedData.data.score;
- timesdied = savedData.data.timesdied;
- died1time = savedData.data.died1time;
- gametimer = savedData.data.gametimer;
- enemieskilled = savedData.data.enemieskilled;
- BulletLength = savedData.data.BulletLength;
- playthegameach = savedData.data.playthegameach;
- asteroidkillerach = savedData.data.asteroidkillerach;
- asteroidkiller2ach = savedData.data.asteroidkiller2ach;
- asteroidkiller3ach = savedData.data.asteroidkiller3ach;
- asteroidkiller4ach = savedData.data.asteroidkiller4ach;
- a1minuteplayed = savedData.data.a1minuteplayed;
- a5minuteplayed = savedData.data.a5minuteplayed;
- a15minuteplayed = savedData.data.a15minuteplayed;
- a30minuteplayed = savedData.data.a30minuteplayed;
- a60minuteplayed = savedData.data.a60minuteplayed;
- died10time = savedData.data.died10time;
- died50time = savedData.data.died50time;
- died100time = savedData.data.died100time;
- teleported1time = savedData.data.teleported1time;
- teleported100time = savedData.data.teleported100time;
- teleported1000time = savedData.data.teleported1000time;
- randommax = savedData.data.randommax;
- fireratemax = savedData.data.fireratemax;
- shotpowermax = savedData.data.shotpowermax;
- shotdistancemax = savedData.data.shotdistancemax;
- turnspeedmax = savedData.data.turnspeedmax;
- brakesmax = savedData.data.brakesmax;
- topspeedmax = savedData.data.topspeedmax;
- thrustmax = savedData.data.thrustmax;
- duckyach = savedData.data.duckyach;
- nduckyach = savedData.data.nduckyach;
- cantach = savedData.data.cantach;
- tinyach = savedData.data.tinyach;
- miniach = savedData.data.miniach;
- averageach = savedData.data.averageach;
- largeach = savedData.data.largeach;
- gigantoach = savedData.data.gigantoach;
- shopMenu.ShieldButton.Upgrade.gotoAndStop(ship.ShieldPower);
- shopMenu.ThrustButton.Upgrade.gotoAndStop(ship.thrustVar);
- shopMenu.BulletLengthButton.Upgrade.gotoAndStop(BulletLength -= 1);
- shopMenu.FireRateButton.Upgrade.gotoAndStop(ship.shootTimerVar);
- shopMenu.BrakesButton.Upgrade.gotoAndStop(ship.brakesVar);
- shopMenu.TopSpeedButton.Upgrade.gotoAndStop(ship.topSpeedVar);
- shopMenu.TurnSpeedButton.Upgrade.gotoAndStop(ship.turnSpeedVar);
- shopMenu.NumberOfShotsButton.Upgrade.gotoAndStop(ship.numberOfBulletsVar);
- if (died1time == true)
- {
- achMenu.die.gotoAndStop(2);
- }
- if (playthegameach == true)
- {
- achMenu.welc.gotoAndStop(2);
- }
- if (asteroidkillerach == true)
- {
- achMenu.akil.gotoAndStop(2);
- }
- if (asteroidkiller2ach == true)
- {
- achMenu.ahun.gotoAndStop(2);
- }
- if (asteroidkiller3ach == true)
- {
- achMenu.leet.gotoAndStop(2);
- }
- if (asteroidkiller4ach == true)
- {
- achMenu.over.gotoAndStop(2);
- }
- if (a1minuteplayed == true)
- {
- achMenu.wadi.gotoAndStop(2);
- }
- if (a5minuteplayed == true)
- {
- achMenu.bein.gotoAndStop(2);
- }
- if (a15minuteplayed == true)
- {
- achMenu.game.gotoAndStop(2);
- }
- if (a30minuteplayed == true)
- {
- achMenu.must.gotoAndStop(2);
- }
- if (a60minuteplayed == true)
- {
- achMenu.goou.gotoAndStop(2);
- }
- if (died10time == true)
- {
- achMenu.pers.gotoAndStop(2);
- }
- if (died50time == true)
- {
- achMenu.just.gotoAndStop(2);
- }
- if (died100time == true)
- {
- achMenu.suic.gotoAndStop(2);
- }
- if (teleported1time == true)
- {
- achMenu.ohha.gotoAndStop(2);
- }
- if (teleported100time == true)
- {
- achMenu.step.gotoAndStop(2);
- }
- if (teleported1000time == true)
- {
- achMenu.leap.gotoAndStop(2);
- }
- if (randommax == true)
- {
- achMenu.rand.gotoAndStop(2);
- achMenu.cant.gotoAndStop(2);
- }
- if (fireratemax == true)
- {
- achMenu.quic.gotoAndStop(2);
- }
- if (shotpowermax == true)
- {
- achMenu.shot.gotoAndStop(2);
- }
- if (shotdistancemax == true)
- {
- achMenu.snip.gotoAndStop(2);
- }
- if (turnspeedmax == true)
- {
- achMenu.turn.gotoAndStop(2);
- }
- if (brakesmax == true)
- {
- achMenu.brak.gotoAndStop(2);
- }
- if (topspeedmax == true)
- {
- achMenu.tops.gotoAndStop(2);
- }
- if (thrustmax == true)
- {
- achMenu.thru.gotoAndStop(2);
- }
- if (duckyach == true)
- {
- achMenu.duck.gotoAndStop(2);
- }
- if (nduckyach == true)
- {
- achMenu.ninj.gotoAndStop(2);
- }
- if (tinyach == true)
- {
- achMenu.tiny.gotoAndStop(2);
- }
- if (miniach == true)
- {
- achMenu.mini.gotoAndStop(2);
- }
- if (averageach == true)
- {
- achMenu.aver.gotoAndStop(2);
- }
- if (largeach == true)
- {
- achMenu.larg.gotoAndStop(2);
- }
- if (gigantoach == true)
- {
- achMenu.giga.gotoAndStop(2);
- }
- }
- }
- }
- function save(e:Event)
- {
- trace(died1time);
- savedData.data.died1time = died1time;
- savedData.data.timesdied = timesdied;
- savedData.data.score = score;
- savedData.data.gametimer = gametimer;
- savedData.data.enemieskilled = enemieskilled;
- savedData.data.BulletLength = BulletLength;
- savedData.data.playthegameach = playthegameach;
- savedData.data.asteroidkillerach = asteroidkillerach;
- savedData.data.asteroidkiller2ach = asteroidkiller2ach;
- savedData.data.asteroidkiller3ach = asteroidkiller3ach;
- savedData.data.asteroidkiller4ach = asteroidkiller4ach;
- savedData.data.a1minuteplayed = a1minuteplayed;
- savedData.data.a5minuteplayed = a5minuteplayed;
- savedData.data.a15minuteplayed = a15minuteplayed;
- savedData.data.a30minuteplayed = a30minuteplayed;
- savedData.data.a60minuteplayed = a60minuteplayed;
- savedData.data.died10time = died10time;
- savedData.data.died50time = died50time;
- savedData.data.died100time = died100time;
- savedData.data.teleported1time = teleported1time;
- savedData.data.teleported100time = teleported100time;
- savedData.data.teleported1000time = teleported1000time;
- savedData.data.randommax = randommax;
- savedData.data.fireratemax = fireratemax;
- savedData.data.shotpowermax = shotpowermax;
- savedData.data.shotdistancemax = shotdistancemax;
- savedData.data.turnspeedmax = turnspeedmax;
- savedData.data.brakesmax = brakesmax;
- savedData.data.topspeedmax = topspeedmax;
- savedData.data.thrustmax = thrustmax;
- savedData.data.duckyach = duckyach;
- savedData.data.nduckyach = nduckyach;
- savedData.data.cantach = cantach;
- savedData.data.tinyach = tinyach;
- savedData.data.miniach = miniach;
- savedData.data.averageach = averageach;
- savedData.data.largeach = largeach;
- savedData.data.gigantoach = gigantoach;
- }
- function instructback(e:Event)
- {
- Instructions.visible = false;
- mainMenu.visible = true;
- }
- function toggleshipmode(e:Event)
- {
- if (ship.ShieldPower > 4)
- {
- if (ship.isduck == false)
- {
- mainMenu.ShipMode.gotoAndStop(3);
- ship.isduck = true;
- }
- else
- {
- mainMenu.ShipMode.gotoAndStop(2);
- ship.isduck = false;
- }
- }
- }
- function togglestory(e:Event)
- {
- if (Game.ship.skipstory == false)
- {
- Game.ship.skipstory = true;
- mainMenu.storybox.gotoAndStop(2);
- }
- else
- {
- mainMenu.storybox.gotoAndStop(1);
- Game.ship.skipstory = false;
- }
- }
- function togglehardmode(e:Event)
- {
- if (ship.ShieldPower > 6)
- {
- if (doubleenemies == false)
- {
- mainMenu.hardmodebox.gotoAndStop(3);
- doubleenemies = true;
- trace('banana');
- }
- else
- {
- mainMenu.hardmodebox.gotoAndStop(2);
- doubleenemies = false;
- }
- }
- }
- function ShieldButtonCost(e:Event)
- {
- shopMenu.BackButton.UpgradeText.visible = true;
- shopMenu.BackButton.UpgradeText.text = 1000 * ship.ShieldPower;
- }
- function ThrustButtonCost(e:Event)
- {
- shopMenu.BackButton.UpgradeText.visible = true;
- shopMenu.BackButton.UpgradeText.text = 500 * ship.thrustVar;
- }
- function BulletLengthButtonCost(e:Event)
- {
- shopMenu.BackButton.UpgradeText.visible = true;
- shopMenu.BackButton.UpgradeText.text = 750 * BulletLength;
- }
- function FireRateButtonCost(e:Event)
- {
- shopMenu.BackButton.UpgradeText.visible = true;
- shopMenu.BackButton.UpgradeText.text = 750 * ship.shootTimerVar;
- }
- function BrakesButtonCost(e:Event)
- {
- shopMenu.BackButton.UpgradeText.visible = true;
- shopMenu.BackButton.UpgradeText.text = 500 * ship.brakesVar;
- }
- function TopSpeedButtonCost(e:Event)
- {
- shopMenu.BackButton.UpgradeText.visible = true;
- shopMenu.BackButton.UpgradeText.text = 500 * ship.topSpeedVar;
- }
- function TurnSpeedButtonCost(e:Event)
- {
- shopMenu.BackButton.UpgradeText.visible = true;
- shopMenu.BackButton.UpgradeText.text = 500 * ship.turnSpeedVar;
- }
- function NumberOfShotsButtonCost(e:Event)
- {
- shopMenu.BackButton.UpgradeText.visible = true;
- shopMenu.BackButton.UpgradeText.text = 1000 * ship.numberOfBulletsVar;
- }
- function CostReset(e:Event)
- {
- shopMenu.BackButton.UpgradeText.visible = false;
- }
- static function gameOver()
- {
- if (timesdied == 1)
- {
- if (died1time == false)
- {
- updateach("Achievement Unlocked: Die");
- updateScore(200);
- died1time = true;
- achMenu.die.gotoAndStop(2);
- }
- }
- if (timesdied == 10)
- {
- if (died10time == false)
- {
- updateach("Achievement Unlocked: Persistent");
- updateScore(1000);
- died10time = true;
- achMenu.pers.gotoAndStop(2);
- }
- }
- if (timesdied == 50)
- {
- if (died50time == false)
- {
- updateach("Achievement Unlocked: Just keep dieing");
- updateScore(3000);
- died50time = true;
- achMenu.just.gotoAndStop(2);
- }
- }
- if (timesdied == 100)
- {
- if (died100time == false)
- {
- updateach("Achievement Unlocked: Suicidal");
- updateScore(5000);
- died100time = true;
- achMenu.suic.gotoAndStop(2);
- }
- }
- gameOverMenu.visible = true;
- gameOverMenu.x = 300;
- gameOverMenu.y = 300;
- enemyShipTimer.stop();
- enemyShip2Timer.stop();
- enemyShip3Timer.stop();
- enemyShip4Timer.stop();
- enemyShip5Timer.stop();
- specialShipTimer.stop();
- ship.Round = 0;
- for (var i in list)
- {
- list[i].gameoverdie();
- }
- }
- function showmainmenu(e:Event)
- {
- trace(ship.roundtimer);
- shopMenu.visible = false;
- achMenu.visible = false;
- mainMenu.visible = true;
- gameOverMenu.visible = false;
- }
- function newGame(e:Event)
- {
- if (playthegameach == false)
- {
- updateach("Achievement Unlocked:Play the game");
- playthegameach = true;
- updateScore(200);
- achMenu.welc.gotoAndStop(2);
- }
- ship.changemode();
- mainMenu.visible = false;
- gameOverMenu.visible = false;
- ship.visible = true;
- ship.x = 200;
- ship.y = 300;
- ship.thrust = 0;
- ship.addEventListener("enterFrame", ship.move);
- ship.Round = 1;
- specialShipTimer.start();
- ship.invulnTimer = 0;
- ship.invulnUsed = false;
- }
- function showShop(e:Event)
- {
- mainMenu.visible = false;
- shopMenu.visible = true;
- }
- function showAch(e:Event)
- {
- mainMenu.visible = false;
- achMenu.visible = true;
- }
- function showInstruct(e:Event)
- {
- mainMenu.visible = false;
- Instructions.visible = true;
- }
- function showMainMenu(e:Event)
- {
- mainMenu.visible = true;
- shopMenu.visible = false;
- }
- function sendEnemy(e:Event)
- {
- var enemy = new EnemyShip();
- stage.addChild(enemy);
- }
- function sendEnemy2(e:Event)
- {
- var enemy2 = new EnemyShip2();
- stage.addChild(enemy2);
- }
- function sendEnemy3(e:Event)
- {
- var enemy3 = new EnemyShip3();
- stage.addChild(enemy3);
- }
- function sendEnemy4(e:Event)
- {
- var enemy4 = new EnemyShip4();
- stage.addChild(enemy4);
- }
- function sendEnemy5(e:Event)
- {
- var enemy5 = new EnemyShip5();
- stage.addChild(enemy5);
- }
- function sendspecialEnemy(e:Event)
- {
- if (Math.random() < .001 && ship.ShieldPower > 8)
- {
- var special = new SpecialShip();
- stage.addChild(special);
- }
- }
- static function updateScore(points)
- {
- score += points;
- scoreText.text = String(score);
- }
- static function updateach(ach)
- {
- achtimer = 0;
- myTextField.text = String(ach);
- }
- static function resetScore()
- {
- score = 0;
- scoreText.text = String(score);
- }
- function UpgradeShield(e:Event)
- {
- trace('banana');
- if (ship.ShieldPower == 5)
- {
- mainMenu.ShipMode.gotoAndStop(2);
- }
- if (ship.ShieldPower > 6)
- {
- mainMenu.hardmodebox.gotoAndStop(2);
- }
- if (Game.ship.ShieldPower < 11)
- {
- if (1000 * Game.ship.ShieldPower <= score)
- {
- if (Game.ship.ShieldPower == 10)
- {
- if (randommax == false)
- {
- randommax = true;
- updateach("Achievement Unlocked: Randomizer, Cant Touch This");
- updateScore(1000);
- randommax = true;
- achMenu.rand.gotoAndStop(2);
- achMenu.cant.gotoAndStop(2);
- }
- }
- updateScore(-1000*ship.ShieldPower);
- Game.ship.ShieldPower += 1;
- shopMenu.ShieldButton.Upgrade.gotoAndStop(ship.ShieldPower);
- shopMenu.BackButton.UpgradeText.text = 1000 * ship.ShieldPower;
- }
- }
- }
- function UpgradeThrust(e:Event)
- {
- if (500 * Game.ship.thrustVar <= score)
- {
- if (Game.ship.thrustVar == 10)
- {
- if (thrustmax == false)
- {
- thrustmax = true;
- updateach("Achievement Unlocked: Thrusters Primed");
- updateScore(1000);
- thrustmax = true;
- achMenu.thru.gotoAndStop(2);
- }
- }
- if (Game.ship.thrustVar < 11)
- {
- updateScore(-500*ship.thrustVar);
- Game.ship.thrustVar += 1;
- shopMenu.ThrustButton.Upgrade.gotoAndStop(ship.thrustVar);
- shopMenu.BackButton.UpgradeText.text = 500 * ship.thrustVar;
- }
- }
- }
- function UpgradeFireRate(e:Event)
- {
- if (750 * Game.ship.shootTimerVar <= score)
- {
- if (Game.ship.shootTimerVar == 10)
- {
- if (fireratemax == false)
- {
- fireratemax = true;
- updateach("Achievement Unlocked: QuickDraw");
- updateScore(1000);
- fireratemax = true;
- achMenu.quic.gotoAndStop(2);
- }
- }
- if (ship.shootTimerVar < 11)
- {
- updateScore(-750*ship.shootTimerVar);
- Game.ship.shootTimerVar += 1;
- shopMenu.FireRateButton.Upgrade.gotoAndStop(ship.shootTimerVar);
- shopMenu.BackButton.UpgradeText.text = 750 * ship.shootTimerVar;
- }
- }
- }
- function UpgradeBulletLength(e:Event)
- {
- if (750 * BulletLength <= score)
- {
- if (BulletLength == 10)
- {
- if (shotdistancemax == false)
- {
- shotdistancemax = true;
- updateach("Achievement Unlocked: Sniper");
- updateScore(1000);
- shotdistancemax = true;
- achMenu.snip.gotoAndStop(2);
- }
- }
- if (BulletLength < 11)
- {
- updateScore(-750*BulletLength);
- BulletLength += 1;
- shopMenu.BulletLengthButton.Upgrade.gotoAndStop(BulletLength);
- shopMenu.BackButton.UpgradeText.text = 750 * BulletLength;
- }
- }
- }
- function UpgradeBrakes(e:Event)
- {
- if (500 * Game.ship.brakesVar <= score)
- {
- if (Game.ship.brakesVar == 10)
- {
- if (brakesmax == false)
- {
- brakesmax = true;
- updateach("Achievement Unlocked: STOP!");
- updateScore(1000);
- brakesmax = true;
- achMenu.brak.gotoAndStop(2);
- }
- }
- if (Game.ship.brakesVar < 11)
- {
- updateScore(-500*ship.brakesVar);
- Game.ship.brakesVar += 1;
- shopMenu.BrakesButton.Upgrade.gotoAndStop(Game.ship.brakesVar);
- shopMenu.BackButton.UpgradeText.text = 500 * ship.brakesVar;
- }
- }
- }
- function UpgradeTopSpeed(e:Event)
- {
- if (500 * Game.ship.topSpeedVar <= score)
- {
- if (Game.ship.topSpeedVar == 10)
- {
- if (topspeedmax == false)
- {
- topspeedmax = true;
- updateach("Achievement Unlocked: Super Fast");
- updateScore(1000);
- topspeedmax = true;
- achMenu.tops.gotoAndStop(2);
- }
- }
- if (Game.ship.topSpeedVar < 11)
- {
- updateScore(-500*ship.topSpeedVar);
- Game.ship.topSpeedVar += 1;
- shopMenu.TopSpeedButton.Upgrade.gotoAndStop(Game.ship.topSpeedVar);
- shopMenu.BackButton.UpgradeText.text = 500 * ship.topSpeedVar;
- }
- }
- }
- function UpgradeTurnSpeed(e:Event)
- {
- if (500 * Game.ship.turnSpeedVar <= score)
- {
- if (Game.ship.turnSpeedVar == 10)
- {
- if (turnspeedmax == false)
- {
- turnspeedmax = true;
- updateach("Achievement Unlocked: Spin Spin Spin");
- updateScore(1000);
- turnspeedmax = true;
- achMenu.turn.gotoAndStop(2);
- }
- }
- if (ship.turnSpeedVar < 11)
- {
- updateScore(-500*ship.turnSpeedVar);
- Game.ship.turnSpeedVar += 1;
- shopMenu.TurnSpeedButton.Upgrade.gotoAndStop(Game.ship.turnSpeedVar);
- shopMenu.BackButton.UpgradeText.text = 500 * ship.turnSpeedVar;
- }
- }
- }
- function UpgradeNumberOfShots(e:Event)
- {
- if (1000 * Game.ship.numberOfBulletsVar <= score)
- {
- if (Game.ship.numberOfBulletsVar == 10)
- {
- if (shotpowermax == false)
- {
- shotpowermax = true;
- updateach("Achievement Unlocked: Shoot EVERYTHING!");
- updateScore(1000);
- shotpowermax = true;
- achMenu.shot.gotoAndStop(2);
- }
- }
- if (Game.ship.numberOfBulletsVar < 11)
- {
- updateScore(-1000*ship.numberOfBulletsVar);
- Game.ship.numberOfBulletsVar += 1;
- shopMenu.NumberOfShotsButton.Upgrade.gotoAndStop(ship.numberOfBulletsVar);
- shopMenu.BackButton.UpgradeText.text = 1000 * ship.numberOfBulletsVar;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement