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