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

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

StarShine.swf

This is the info page for
Flash #22790

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


Text
Actions

0 %

<p align="center"><font face="Girls are Weird" size="36" color="#ffffff" letterSpacing="0.000000" kerning="0"><b>Loading...</b></font></p>

<p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">This game has </font></p><p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">incorrect dimensions,</font></p><p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0"> should be 550x550px</font></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b>Click Here to play</b></a></font></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b> the REAL GAME</b></a><font color="#ffffff"><a href="http://www.armorgames.com/games/starshine.html"><b> </b></a></font></font></p>

<p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">This game has </font></p><p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">incorrect dimensions,</font></p><p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0"> should be 550x550px</font></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b>Click Here to play</b></a></font></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b> the REAL GAME</b></a><font color="#ffffff"><a href="http://www.armorgames.com/games/starshine.html"><b> </b></a></font></font></p>

<p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">This game has </font></p><p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">incorrect dimensions,</font></p><p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0"> should be 550x550px</font></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b>Click Here to play</b></a></font></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b> the REAL GAME</b></a><font color="#ffffff"><b> </b></font></font></p>

<p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">This game has </font></p><p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">incorrect dimensions,</font></p><p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0"> should be 550x550px</font></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b>Click Here to play</b></a></font></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b> the REAL GAME</b></a><font color="#ffffff"><b> </b></font></font></p>

<p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">This game has incorrect dimensions, should be 550x550px</font></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b>Click Here to play the REAL GAME</b></a><font color="#ffffff"><a href="http://www.armorgames.com/games/starshine.html"><b> </b></a></font></font></p>

Hero Interactive
Presents

level select

level select

settings

settings

credits

credits

play more games

play more games

StarShine

<p align="center"><font face="_sans" size="10" color="#ffffff" letterSpacing="0.000000" kerning="0"><b>V 1.3</b></font></p>

back

back

back

Music

Sounds

Low

Medium

High

On

Off

Graphics

Game Settings:

Created By
Jared Riley
-and-
Eric Ottati

<p align="center"><font face="Girls are Weird" size="39" color="#fadafe" letterSpacing="0.000000" kerning="0"><a href="http://www.herointeractive.com" target = "_blank"><b>Hero Interactive, LLC</b></a></font></p><p align="center"><font face="Girls are Weird" size="39" color="#ffffff" letterSpacing="0.000000" kerning="0"><a href="http://www.herointeractive.com" target = "_blank"><b>www.herointeractive.com</b></a></font></p>

Credits:

Level Select:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

Select the best place to shoot
your star, to light the rest.
Click your mouse to shoot.

Whoops...

Retry?

Retry?

Main Menu

Main Menu

More Games

More Games

Well Done!

Next Level!

Next Level!

Remember, sometimes you
need to hit  at different
angles to succeed!

Good Luck!

Congratulations!
You've won the game!

Whoa! There are no more levels!

<p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">This game has been set up incorrectly with </font></p><p align="center"><font face="_sans" size="14" color="#ffffff" letterSpacing="0.000000" kerning="0">incorrect dimensions: &nbsp;it should be 550x550px</font></p><p align="center"></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b>Click Here to play</b></a></font></p><p align="center"><font face="_sans" size="14" color="#33ccff" letterSpacing="0.000000" kerning="0"><a href="http://www.armorgames.com/games/starshine.html"><b> the game on author&apos;s server</b></a></font></p>

ActionScript [AS1/AS2]

Frame 1
stop(); _global.myMusicPlayer = new Music(); _global.SoundManager = new SoundPlayer(); _global.musicOn = true; _global.soundOn = true; _global.isClicked = 0; _global.theLevel = ""; _global.currentLevel = 20; _global.latestLevel = 0; _global.levels = new Array(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); var mySharedObject = SharedObject.getLocal("userData"); if (mySharedObject.data.levelsCompleted != undefined) { _global.levels = mySharedObject.data.levelsCompleted; } trace(_global.levels);
Instance of Symbol 32 MovieClip in Frame 1
onClipEvent (load) { myFlag = 0; Counter = -1; totalFileSize = _root.getBytesTotal(); startBytes = _root.getBytesLoaded(); _root.continueButton._visible = false; _root.loadStar.gotoAndStop(1); } onClipEvent (enterFrame) { if (Counter == -1) { bytesLoaded = _root.getBytesLoaded(); amountLoaded = bytesLoaded / totalFileSize; myPercentLoaded = int(100 * amountLoaded); _root.load_txt.text = myPercentLoaded + "%"; _root.loadStar.gotoAndStop(myPercentLoaded); if ((amountLoaded >= 1) && (myFlag == 0)) { myFlag = 1; Counter = 30; if (_global.latestLevel != 0) { Counter = 0; } } } else if (Counter == 0) { okToPlay = true; siteURL = "http://www.herointeractive.com"; siteURL2 = "http://herointeractive.com"; if ((_url.substr(0, siteURL.length) == siteURL) || (_url.substr(0, siteURL2.length) == siteURL2)) { okToPlay = true; } if (okToPlay) { if (_global.latestLevel == 0) { _root.gotoAndPlay("loadSounds"); } else { _root.gotoAndPlay("level1"); } } } else { Counter--; } }
Frame 5
function __com_mochibot__(swfid, mc, lv, trk) { var x; var g; var s; var fv; var sb; var u; var res; var mb; var mbc; mb = "__mochibot__"; mbc = "mochibot.com"; g = (_global ? (_global) : (_level0._root)); if (g[mb + swfid]) { return(g[mb + swfid]); } s = System.security; x = mc._root.getSWFVersion; fv = (x ? (mc.getSWFVersion()) : ((_global ? 6 : 5))); if (!s) { s = {}; } sb = s.sandboxType; if (sb == "localWithFile") { return(null); } x = s.allowDomain; if (x) { s.allowDomain(mbc); } x = s.allowInsecureDomain; if (x) { s.allowInsecureDomain(mbc); } u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=7&fv=") + fv) + "&v=") + escape(getVersion())) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : ""); lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv)))); g[mb + "level"] = lv; if (fv == 5) { res = "_level" + lv; if (!eval (res)) { loadMovieNum (u, lv); } } else { res = mc.createEmptyMovieClip(mb + swfid, lv); res.loadMovie(u); } return(res); } __com_mochibot__("83eb5956", this, 10301, true); if ((Stage.height > 550) || (Stage.width > 550)) { _root.gotoAndPlay("broke"); } stop();
Frame 6
stop();
Frame 10
stop();
Instance of Symbol 32 MovieClip in Frame 10
onClipEvent (load) { if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("title"); _global.myMusicPlayer.SetMaxVolume(100); _global.myMusicPlayer.PlayWithCrossFade(4); } } onClipEvent (enterFrame) { _global.myMusicPlayer.RunPlayer(); }
Frame 12
stop();
Instance of Symbol 100 MovieClip "low" in Frame 12
onClipEvent (load) { if (_quality == "LOW") { this.gotoAndStop("on"); } } on (rollOver) { this.gotoAndStop("on"); } on (rollOut) { if (_quality != "LOW") { this.gotoAndStop("off"); } } on (release) { _quality = "LOW"; this._parent.high.gotoAndStop("off"); this._parent.med.gotoAndStop("off"); }
Instance of Symbol 100 MovieClip "med" in Frame 12
onClipEvent (load) { if (_quality == "MEDIUM") { this.gotoAndStop("on"); } } on (rollOver) { this.gotoAndStop("on"); } on (rollOut) { if (_quality != "MEDIUM") { this.gotoAndStop("off"); } } on (release) { _quality = "MEDIUM"; this._parent.high.gotoAndStop("off"); this._parent.low.gotoAndStop("off"); }
Instance of Symbol 100 MovieClip "high" in Frame 12
onClipEvent (load) { if (_quality == "HIGH") { this.gotoAndStop("on"); } } on (rollOver) { this.gotoAndStop("on"); } on (rollOut) { if (_quality != "HIGH") { this.gotoAndStop("off"); } } on (release) { _quality = "HIGH"; this._parent.low.gotoAndStop("off"); this._parent.med.gotoAndStop("off"); }
Instance of Symbol 100 MovieClip "musicOn" in Frame 12
onClipEvent (load) { if (_global.musicOn == true) { this.gotoAndStop("on"); } } on (rollOver) { this.gotoAndStop("on"); } on (rollOut) { if (_global.musicOn != true) { this.gotoAndStop("off"); } } on (release) { _global.musicOn = true; this._parent.musicOff.gotoAndStop("off"); _global.myMusicPlayer.SetTrack("titleMusic"); _global.myMusicPlayer.SetMaxVolume(100); _global.myMusicPlayer.Play(); }
Instance of Symbol 100 MovieClip "musicOff" in Frame 12
onClipEvent (load) { if (_global.musicOn == false) { this.gotoAndStop("on"); } } on (rollOver) { this.gotoAndStop("on"); } on (rollOut) { if (_global.musicOn == true) { this.gotoAndStop("off"); } } on (release) { _global.musicOn = false; this._parent.musicOn.gotoAndStop("off"); _global.myMusicPlayer.Stop(); }
Instance of Symbol 100 MovieClip "soundsOn" in Frame 12
onClipEvent (load) { if (_global.soundOn == true) { this.gotoAndStop("on"); } } on (rollOver) { this.gotoAndStop("on"); } on (rollOut) { if (_global.soundOn != true) { this.gotoAndStop("off"); } } on (release) { _global.soundOn = true; this._parent.soundsOff.gotoAndStop("off"); }
Instance of Symbol 100 MovieClip "soundsOff" in Frame 12
onClipEvent (load) { if (_global.soundOn == false) { this.gotoAndStop("on"); } } on (rollOver) { this.gotoAndStop("on"); } on (rollOut) { if (_global.soundOn == true) { this.gotoAndStop("off"); } } on (release) { _global.soundOn = false; this._parent.soundsOn.gotoAndStop("off"); }
Instance of Symbol 32 MovieClip in Frame 12
onClipEvent (load) { if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("title"); _global.myMusicPlayer.SetMaxVolume(100); _global.myMusicPlayer.PlayWithCrossFade(4); } } onClipEvent (enterFrame) { _global.myMusicPlayer.RunPlayer(); }
Frame 14
stop();
Instance of Symbol 32 MovieClip in Frame 14
onClipEvent (load) { if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("title"); _global.myMusicPlayer.SetMaxVolume(100); _global.myMusicPlayer.PlayWithCrossFade(4); } } onClipEvent (enterFrame) { _global.myMusicPlayer.RunPlayer(); }
Frame 16
function SelectLevel(strName) { var _local3 = Number(strName.substr(1, 2)); trace(_local3); _global.latestLevel = (_local3 * 5) + 15; _root.gotoAndPlay("level1"); } stop();
Instance of Symbol 32 MovieClip in Frame 16
onClipEvent (load) { var movName; var i = 1; while (i < _global.levels.length) { movName = "l" + i; if (_global.levels[i] == 1) { _root[movName].gotoAndStop("unlocked"); } else { _root[movName].gotoAndStop("locked"); } i++; } if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("title"); _global.myMusicPlayer.SetMaxVolume(100); _global.myMusicPlayer.PlayWithCrossFade(4); } } onClipEvent (enterFrame) { _global.myMusicPlayer.RunPlayer(); }
Frame 20
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Instance of Symbol 32 MovieClip in Frame 20
onClipEvent (load) { _root.GameSetup(); } onClipEvent (enterFrame) { _root.Mediator(); }
Frame 25
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Instance of Symbol 32 MovieClip in Frame 25
onClipEvent (load) { _root.GameSetup(); } onClipEvent (enterFrame) { _root.Mediator(); }
Frame 30
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Instance of Symbol 32 MovieClip in Frame 30
onClipEvent (load) { _root.GameSetup(); } onClipEvent (enterFrame) { _root.Mediator(); }
Frame 35
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Instance of Symbol 32 MovieClip in Frame 35
onClipEvent (load) { _root.GameSetup(); } onClipEvent (enterFrame) { _root.Mediator(); }
Frame 40
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Instance of Symbol 32 MovieClip in Frame 40
onClipEvent (load) { _root.GameSetup(); } onClipEvent (enterFrame) { _root.Mediator(); }
Frame 45
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Instance of Symbol 32 MovieClip in Frame 45
onClipEvent (load) { _root.GameSetup(); } onClipEvent (enterFrame) { _root.Mediator(); }
Frame 50
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Instance of Symbol 32 MovieClip in Frame 50
onClipEvent (load) { _root.GameSetup(); } onClipEvent (enterFrame) { _root.Mediator(); }
Frame 55
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Instance of Symbol 32 MovieClip in Frame 55
onClipEvent (load) { _root.GameSetup(); } onClipEvent (enterFrame) { _root.Mediator(); }
Frame 60
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 65
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 70
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 75
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 80
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 85
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 90
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 95
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 100
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 105
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 110
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 115
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 120
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 125
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 130
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 135
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 140
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 145
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 150
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 155
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 160
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 165
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 170
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 175
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 180
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 185
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 190
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 195
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 200
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 205
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 210
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 215
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 220
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 225
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 230
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 235
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 240
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 245
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 250
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 255
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 260
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 265
function GameSetup() { trace("%%%%%%%%"); trace((_global.currentLevel + " ----- ") + _global.latestLevel); if (_global.latestLevel == -1) { _root.gotoAndPlay("splash"); } else if ((_global.latestLevel != 0) && (_global.latestLevel != 20)) { _global.currentLevel = _global.latestLevel; _root.gotoAndPlay(_global.latestLevel); _global.latestLevel = 0; trace("go here"); } else if ((_global.latestLevel != 0) && (_global.latestLevel == 20)) { _global.currentLevel = _global.latestLevel; _global.latestLevel = 0; } if (_root.messages_mc.getDepth() != 50000) { saveDepth = _root.messages_mc.getDepth(); } vecShootDir = new Vector(); if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("game"); _global.myMusicPlayer.SetMaxVolume(40); _global.myMusicPlayer.PlayWithCrossFade(4); } } function Mediator() { _global.myMusicPlayer.RunPlayer(); switch (intState) { case 1 : AimProjectile(); if (_root.messages_mc.getDepth() != 50000) { _root.messages_mc.swapDepths(50000); trace(_root.messages_mc.getDepth()); } break; case 2 : if (projectileOver == false) { MoveProjectile(); } DetectParticleCollisions(); MoveProjectilesAndCollide(); break; case 3 : if (Key.isDown(32)) { Reset(); } break; case 4 : if (!Key.isDown(32)) { break; } Next(); } } function Reset() { projectileDepth = 5000; arrParticles = arrParticlesReset.slice(); var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].gotoAndStop(1); trace(arrParticles[_local2]); _local2++; } trace("-----"); _root.projectile.gotoAndStop(1); _root.gameBackground.gotoAndStop(1); _root.messages_mc.gotoAndStop("hide"); projectileOver = false; projectileOnScreen = false; intState = 1; } function ExitGame() { CleanupGame(); Mouse.removeListener(mouseListener); _root.messages_mc.swapDepths(saveDepth); _global.latestLevel = -1; _root.gotoAndPlay("level1"); } function Next() { _global.currentLevel = _global.currentLevel + 5; CleanupGame(); _root.messages_mc.swapDepths(saveDepth); _root.gotoAndPlay(_global.currentLevel); } function CleanupGame() { Mouse.removeListener(mouseListener); Reset(); var _local3 = 10; var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].swapDepths(_local3); _local3++; _root[arrParticles[_local2]].removeMovieClip(); _local2++; } delete arrParticles; arrParticles = new Array(); } function DetectParticleCollisions() { var _local3 = new Array(); var _local2 = 0; while (_local2 < arrParticles.length) { var _local4 = (_root[arrParticles[_local2]]._width / 2) + 7.5; if (GetDistance(arrParticles[_local2], "projectile") <= _local4) { _root[arrParticles[_local2]].Collision(saveX, saveY); _local3.push(arrParticles[_local2]); } _local2++; } _local2 = 0; while (_local2 < _local3.length) { RemoveParticle(_local3[_local2]); _root[_local3[_local2]].gotoAndStop(2); _local2++; } } function RemoveParticle(strName) { var _local1 = 0; while (_local1 < arrParticles.length) { if (strName == arrParticles[_local1]) { arrParticles.splice(_local1, 1); break; } _local1++; } } function GetDistance(targetA, targetB) { var _local3 = _root[targetB]._x - _root[targetA]._x; var _local2 = _root[targetB]._y - _root[targetA]._y; return(Math.sqrt((_local3 * _local3) + (_local2 * _local2))); } function RegisterParticle(particleName) { arrParticles.push(particleName); arrParticlesReset.push(particleName); particleDepth++; return(particleDepth); } function MoveProjectile() { if (ProjectileOffScreen() == false) { projectileOnScreen = true; _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } else if (projectileOnScreen == true) { projectileOver = true; } else { _root.projectile._x = _root.projectile._x + vecShootDir._x; _root.projectile._y = _root.projectile._y + vecShootDir._y; } } function AimProjectile() { var _local11 = new Vector(); _local11._x = _xmouse - (Stage.width / 2); _local11._y = _ymouse - (Stage.height / 2); var _local12 = Math.atan2(_local11._y, _local11._x); var _local15 = (360 * _local12) / (Math.PI*2); var _local6 = _root.gameBackground._width / 2; _root.projectile._x = (_local6 * Math.cos(_local12)) + (Stage.width / 2); _root.projectile._y = (_local6 * Math.sin(_local12)) + (Stage.height / 2); _local11._x = (Stage.width / 2) - _root.projectile._x; _local11._y = (Stage.height / 2) - _root.projectile._y; _local12 = Math.atan2(_local11._y, _local11._x); var _local14 = Math.cos(_local12) * 11; var _local13 = Math.sin(_local12) * 11; var _local9 = _root.projectile._x; var _local10 = _root.projectile._y; var _local5 = new Array(arrParticles.length); var _local4 = 0; while (_local4 < _local5.length) { _local5[_local4] = 0; _local4++; } var _local8 = 0; while (_local8 < 70) { _local9 = _local9 + _local14; _local10 = _local10 + _local13; _local4 = 0; while (_local4 < arrParticles.length) { var _local7 = (_root[arrParticles[_local4]]._width / 2) + 7.5; var _local3 = _root[arrParticles[_local4]]._x - _local9; var _local2 = _root[arrParticles[_local4]]._y - _local10; _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2)); if (_local6 <= _local7) { _local5[_local4] = 1; } _local4++; } _local8++; } _local4 = 0; while (_local4 < _local5.length) { if (_local5[_local4] == 1) { _root[arrParticles[_local4]].ArrowsOn(arrowDepth, _root.projectile._x, _root.projectile._y); } else { _root[arrParticles[_local4]].ArrowsOff(); } _local4++; } } function TurnOffAllArrows() { var _local2 = 0; while (_local2 < arrParticles.length) { _root[arrParticles[_local2]].ArrowsOff(); _local2++; } } function NextArrowDepth() { arrowDepth++; if (arrowDepth > 39999) { arrowDepth = 15000; } } function DrawLines() { _root.clear(); _root.lineStyle(2, 16777215, 50); var _local2 = new Object(); var _local3 = new Object(); _local2.x = _root.projectile._x; _local2.y = _root.projectile._y; _local3.x = _xmouse; _local3.y = _ymouse; _root.moveTo(_local2.x, _local2.y); _root.lineTo(_local3.x, _local3.y); } function Shoot() { if ((intState == 1) && (_global.latestLevel != -1)) { trace("in"); _root.clear(); saveX = _root.projectile._x; saveY = _root.projectile._y; var _local4 = new Vector(); _local4._x = (Stage.width / 2) - _root.projectile._x; _local4._y = (Stage.height / 2) - _root.projectile._y; var _local5 = Math.atan2(_local4._y, _local4._x); vecShootDir._x = Math.cos(_local5) * 11; vecShootDir._y = Math.sin(_local5) * 11; var _local3 = 100; do { if (ProjectileOffScreen() != false) { break; } _root.projectile._x = _root.projectile._x - vecShootDir._x; _root.projectile._y = _root.projectile._y - vecShootDir._y; _local3--; } while (_local3 != 0); var _local6 = (360 * _local5) / (Math.PI*2); _root.projectile.gotoAndStop(2); _root.projectile._rotation = _local6; _root.gameBackground.gotoAndPlay("hide"); TurnOffAllArrows(); intState = 2; } } function ProjectileOffScreen() { var _local2 = false; if (((_root.projectile._x + _root.projectile._width) < 0) || ((_root.projectile._x - _root.projectile._width) > Stage.width)) { _local2 = true; } if (((_root.projectile._y + _root.projectile._height) < 0) || ((_root.projectile._y - _root.projectile._height) > Stage.height)) { _local2 = true; } return(_local2); } function MoveProjectilesAndCollide() { var _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } var _local5 = new Array(); var _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } _local4 = 0; while (_local4 < arrProjectiles.length) { _root[arrProjectiles[_local4].name]._x = _root[arrProjectiles[_local4].name]._x + (arrProjectiles[_local4].dX / 2); _root[arrProjectiles[_local4].name]._y = _root[arrProjectiles[_local4].name]._y + (arrProjectiles[_local4].dY / 2); if (((_root[arrProjectiles[_local4].name]._x + _root[arrProjectiles[_local4].name]._width) < 0) || ((_root[arrProjectiles[_local4].name]._x - _root[arrProjectiles[_local4].name]._width) > Stage.width)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } if (((_root[arrProjectiles[_local4].name]._y + _root[arrProjectiles[_local4].name]._height) < 0) || ((_root[arrProjectiles[_local4].name]._y - _root[arrProjectiles[_local4].name]._height) > Stage.height)) { _root[arrProjectiles[_local4].name].removeMovieClip(); arrProjectiles.splice(_local4, 1); _local4--; } _local4++; } _local5 = new Array(); _local3 = 0; while (_local3 < arrProjectiles.length) { _local4 = 0; while (_local4 < arrParticles.length) { if (_root[arrParticles[_local4]].hitTest(_root[arrProjectiles[_local3].name]._x, _root[arrProjectiles[_local3].name]._y, true) == true) { _local5.push({name:arrParticles[_local4], X:arrProjectiles[_local3].X, Y:arrProjectiles[_local3].Y}); arrParticles.splice(_local4, 1); _local4--; _root[arrProjectiles[_local3].name].removeMovieClip(); arrProjectiles.splice(_local3, 1); _local3--; } _local4++; } _local3++; } _local4 = 0; while (_local4 < _local5.length) { _root[_local5[_local4].name].Collision(_local5[_local4].X, _local5[_local4].Y); _root[_local5[_local4].name].gotoAndStop(2); _local4++; } if ((arrProjectiles.length == 0) && (projectileOver == true)) { if (arrParticles.length != 0) { intState = 3; _root.messages_mc.gotoAndPlay("retry"); } else { intState = 4; var _local10 = ((_global.currentLevel + 5) - 15) / 5; _global.levels[_local10] = 1; var _local9 = SharedObject.getLocal("userData"); _local9.data.levelsCompleted = _global.levels; _global.SoundManager.PlaySound("all"); _root.messages_mc.gotoAndPlay("next"); } } } function LaunchProjectile(deltaX, deltaY, startX, startY, rot) { var _local2 = "projectile_" + projectileDepth; arrProjectiles.push({name:_local2, dX:deltaX, dY:deltaY, X:startX, Y:startY}); _root.attachMovie("shootingStar", _local2, projectileDepth); _root[_local2]._x = startX; _root[_local2]._y = startY; _root[_local2]._rotation = rot; projectileDepth++; if (projectileDepth > 9999) { projectileDepth = 5000; } } stop(); var intState = 1; var vecShootDir; var arrParticles = new Array(); var arrProjectiles = new Array(); var arrParticlesReset = new Array(); var particleDepth = 1000; var projectileDepth = 5000; var arrowDepth = 15000; var saveX = 0; var saveY = 0; var projectileOnScreen = false; var projectileOver = false; var saveDepth; mouseListener = new Object(); mouseListener.onMouseDown = function () { _root.Shoot(); }; Mouse.addListener(mouseListener);
Frame 270
stop();
Frame 275
gotoAndPlay ("doneStored");
Frame 285
gotoAndPlay ("ads");
Frame 295
stop();
Symbol 2 MovieClip [particle 1] Frame 1
#initclip 15 Object.registerClass("particle 1", Particle_1); #endinitclip
Symbol 10 MovieClip Frame 71
gotoAndPlay (38);
Symbol 12 MovieClip [Star - 3 triangle] Frame 1
#initclip 10 Object.registerClass("Star - 3 triangle", Particle_5); #endinitclip stop();
Symbol 12 MovieClip [Star - 3 triangle] Frame 2
stop();
Symbol 14 MovieClip [Star - 12 blast] Frame 1
#initclip 11 Object.registerClass("Star - 12 blast", Particle_4); #endinitclip stop();
Symbol 14 MovieClip [Star - 12 blast] Frame 2
stop();
Symbol 16 MovieClip [Star - 2 Back] Frame 1
#initclip 12 Object.registerClass("Star - 2 Back", Particle_3); #endinitclip stop();
Symbol 16 MovieClip [Star - 2 Back] Frame 2
stop();
Symbol 18 MovieClip [Star - 1 To 45 Right] Frame 1
#initclip 13 Object.registerClass("Star - 1 To 45 Right", Particle_2); #endinitclip stop();
Symbol 18 MovieClip [Star - 1 To 45 Right] Frame 2
stop();
Symbol 20 MovieClip [star 1] Frame 1
#initclip 14 Object.registerClass("star 1", Particle_1); #endinitclip stop();
Symbol 20 MovieClip [star 1] Frame 2
stop();
Symbol 24 MovieClip [shootingStar] Frame 22
gotoAndPlay (8);
Symbol 40 MovieClip Frame 1
stop();
Symbol 215 MovieClip [__Packages.SoundPlayer] Frame 0
class SoundPlayer { var channelsAvailable, channel1, channel2, channel3, externalSoundVolume; function SoundPlayer () { channelsAvailable = new Array(true, true, true); channel1 = new Sound(); channel2 = new Sound(); channel3 = new Sound(); externalSoundVolume = 100; } function CleanSounds(intIndex) { channelsAvailable[intIndex] = true; } function PlaySound(linkIdentifier) { if (_global.soundOn == true) { var thisRef = this; if (channelsAvailable[0] == true) { channelsAvailable[0] = false; delete channel1; channel1 = new Sound(); channel1.attachSound(linkIdentifier); channel1.setVolume(100); channel1.start(0, 0); channel1.onSoundComplete = function () { thisRef.CleanSounds(0); }; } else if (channelsAvailable[1] == true) { channelsAvailable[1] = false; delete channel2; channel2 = new Sound(); channel2.attachSound(linkIdentifier); channel2.setVolume(70); channel2.start(0, 0); channel2.onSoundComplete = function () { thisRef.CleanSounds(1); }; } else { channelsAvailable[0] = false; delete channel1; channel1 = new Sound(); channel1.attachSound(linkIdentifier); channel1.setVolume(70); channel1.start(0, 0); channel1.onSoundComplete = function () { thisRef.CleanSounds(0); }; } } } function PlayBubbleSound(linkIdentifier) { if (_global.soundOn == true) { var thisRef = this; if (channelsAvailable[2] == true) { channelsAvailable[2] = false; delete channel3; channel3 = new Sound(); channel3.attachSound(linkIdentifier); channel3.setVolume(100); channel3.start(0, 0); channel3.onSoundComplete = function () { thisRef.CleanSounds(2); }; } } } function PlayExternalSound(urlPath) { var thisRef = this; if (channelsAvailable[0] == true) { channelsAvailable[0] = false; delete channel1; channel1 = new Sound(); channel1.loadSound(urlPath, false); channel1.setVolume(externalSoundVolume); channel1.onLoad = function (loadedOK) { if (loadedOK) { this.start(); } }; channel1.onSoundComplete = function () { thisRef.CleanSounds(0); }; } else if (channelsAvailable[1] == true) { channelsAvailable[1] = false; delete channel2; channel2 = new Sound(); channel2.loadSound(urlPath, false); channel2.setVolume(externalSoundVolume); channel2.onLoad = function (loadedOK) { if (loadedOK) { this.start(); } }; channel2.onSoundComplete = function () { thisRef.CleanSounds(1); }; } else { channelsAvailable[0] = false; delete channel1; channel1 = new Sound(); channel1.loadSound(urlPath, false); channel1.setVolume(externalSoundVolume); channel1.onLoad = function (loadedOK) { if (loadedOK) { this.start(); } }; channel1.onSoundComplete = function () { thisRef.CleanSounds(0); }; } } }
Symbol 216 MovieClip [__Packages.Music] Frame 0
class Music { var mySound, volume, currentTrack, inCrossfade, state, changeSongs, maxVolume, targetVolume, volumeSpeed; function Music () { mySound = new Sound(); volume = 100; currentTrack = ""; inCrossfade = false; state = false; changeSongs = true; maxVolume = 60; } function SetMaxVolume(vol) { maxVolume = vol; } function SetTrack(setMusic) { if (setMusic == currentTrack) { changeSongs = false; } else { changeSongs = true; currentTrack = setMusic; } } function Play() { mySound.stop(); mySound.attachSound(currentTrack); volume = maxVolume; mySound.setVolume(volume); mySound.start(0, 2000); state = true; } function Stop() { mySound.stop(); state = false; } function PlayWithCrossFade(secondDuration) { if (changeSongs == true) { if (state == true) { inCrossfade = true; targetVolume = 0; var _local2 = secondDuration * 30; volumeSpeed = (targetVolume - volume) / (_local2 / 2); } else { mySound.stop(); mySound.attachSound(currentTrack); mySound.start(0, 2000); state = true; inCrossfade = false; targetVolume = maxVolume; volume = 0; mySound.setVolume(0); var _local2 = secondDuration * 30; volumeSpeed = (targetVolume - volume) / _local2; } } } function RunPlayer() { if (targetVolume != volume) { var _local2; _local2 = volume + volumeSpeed; if ((volumeSpeed < 0) && (_local2 < 0)) { _local2 = 0; } else if ((volumeSpeed > 0) && (_local2 > targetVolume)) { _local2 = targetVolume; } volume = _local2; mySound.setVolume(_local2); } if (inCrossfade == true) { if (volume <= 0) { volumeSpeed = volumeSpeed * -1; inCrossfade = false; targetVolume = maxVolume; mySound.stop(); mySound.attachSound(currentTrack); mySound.setVolume(0); mySound.start(0, 2000); state = true; } } } }
Symbol 217 MovieClip [__Packages.Particle] Frame 0
class Particle extends MovieClip { var arrPieces, arrArrows, blnHasRegistered, blnArrows, swapDepths, _name, _x, _y; function Particle () { super(); arrPieces = new Array(); arrArrows = new Array(); blnHasRegistered = false; blnArrows = false; Configure(); } function Configure() { } function onEnterFrame() { if (blnHasRegistered == false) { blnHasRegistered = true; swapDepths(_root.RegisterParticle(_name)); } } function ArrowsOn(arrowDepth, X, Y) { if (blnArrows == false) { var _local8 = new Vector(); _local8._x = X - _x; _local8._y = Y - _y; var _local9 = Math.atan2(_local8._y, _local8._x); var _local7 = (360 * _local9) / (Math.PI*2); var _local4 = 0; while (_local4 < arrPieces.length) { var _local6 = _local7 + arrPieces[_local4].launchAngle; var _local3 = "arrow_" + arrowDepth; _root.attachMovie("arrow", _local3, arrowDepth); arrArrows.push(_local3); arrowDepth++; _root.NextArrowDepth(); _root[_local3]._x = _x; _root[_local3]._y = _y; _root[_local3]._rotation = _local6; _local4++; } blnArrows = true; } else { var _local8 = new Vector(); _local8._x = X - _x; _local8._y = Y - _y; var _local9 = Math.atan2(_local8._y, _local8._x); var _local7 = (360 * _local9) / (Math.PI*2); var _local4 = 0; while (_local4 < arrPieces.length) { var _local6 = _local7 + arrPieces[_local4].launchAngle; _root[arrArrows[_local4]]._rotation = _local6; _local4++; } } } function ArrowsOff() { if (blnArrows == true) { var _local3 = 0; while (_local3 < arrArrows.length) { _root[arrArrows[_local3]].removeMovieClip(); _local3++; } delete arrArrows; arrArrows = new Array(); blnArrows = false; } } function Collision(startX, startY) { _global.SoundManager.PlaySound("collect"); var _local8 = new Vector(); _local8._x = startX - _x; _local8._y = startY - _y; var _local9 = Math.atan2(_local8._y, _local8._x); var _local7 = (360 * _local9) / (Math.PI*2); var _local6 = 0; while (_local6 < arrPieces.length) { var _local5 = _local7 + arrPieces[_local6].launchAngle; var _local4 = new Vector(); _local4._x = Math.cos((Math.PI * _local5) / 180) * 11; _local4._y = Math.sin((Math.PI * _local5) / 180) * 11; _root.LaunchProjectile(_local4._x, _local4._y, _x, _y, _local5); _local6++; } } }
Symbol 218 MovieClip [__Packages.Vector] Frame 0
class Vector { var _x, _y; function Vector () { _x = 0; _y = 0; } }
Symbol 219 MovieClip [__Packages.Particle_5] Frame 0
class Particle_5 extends Particle { var arrPieces; function Particle_5 () { super(); } function Configure() { arrPieces.push({launchAngle:180}); arrPieces.push({launchAngle:-60}); arrPieces.push({launchAngle:60}); } }
Symbol 220 MovieClip [__Packages.Particle_4] Frame 0
class Particle_4 extends Particle { var arrPieces; function Particle_4 () { super(); } function Configure() { arrPieces.push({launchAngle:0}); arrPieces.push({launchAngle:30}); arrPieces.push({launchAngle:60}); arrPieces.push({launchAngle:90}); arrPieces.push({launchAngle:120}); arrPieces.push({launchAngle:150}); arrPieces.push({launchAngle:180}); arrPieces.push({launchAngle:210}); arrPieces.push({launchAngle:240}); arrPieces.push({launchAngle:270}); arrPieces.push({launchAngle:300}); arrPieces.push({launchAngle:330}); } }
Symbol 221 MovieClip [__Packages.Particle_3] Frame 0
class Particle_3 extends Particle { var arrPieces; function Particle_3 () { super(); } function Configure() { arrPieces.push({launchAngle:20}); arrPieces.push({launchAngle:-20}); } }
Symbol 222 MovieClip [__Packages.Particle_2] Frame 0
class Particle_2 extends Particle { var arrPieces; function Particle_2 () { super(); } function Configure() { arrPieces.push({launchAngle:135}); } }
Symbol 223 MovieClip [__Packages.Particle_1] Frame 0
class Particle_1 extends Particle { var arrPieces; function Particle_1 () { super(); } function Configure() { arrPieces.push({launchAngle:90}); arrPieces.push({launchAngle:-90}); } }
Symbol 50 Button
on (release) { getURL ("http://www.armorgames.com", "blank"); }
Symbol 57 MovieClip Frame 140
stop();
Instance of Symbol 60 MovieClip in Symbol 61 MovieClip Frame 150
on (release) { getURL ("http://www.herointeractive.com", "_blank"); } onClipEvent (load) { if (_global.musicOn == true) { _global.myMusicPlayer.SetTrack("title"); _global.myMusicPlayer.SetMaxVolume(100); _global.myMusicPlayer.PlayWithCrossFade(4); } } onClipEvent (enterFrame) { _global.myMusicPlayer.RunPlayer(); }
Instance of Symbol 60 MovieClip in Symbol 61 MovieClip Frame 179
on (release) { getURL ("http://www.herointeractive.com", "_blank"); }
Symbol 61 MovieClip Frame 328
_root.gotoAndPlay("splash");
Symbol 70 MovieClip Frame 1
r = random(200); r = r + 50; gotoAndPlay(r);
Symbol 75 MovieClip Frame 160
_root.gotoAndPlay("main menu"); stop();
Symbol 80 Button
on (release) { gotoAndPlay ("level select"); _global.SoundManager.PlaySound("button"); }
Symbol 84 Button
on (release) { gotoAndPlay ("settings"); _global.SoundManager.PlaySound("button"); }
Symbol 87 Button
on (release) { gotoAndPlay ("credits"); _global.SoundManager.PlaySound("button"); }
Symbol 90 Button
on (release) { getURL ("http://www.armorgames.com/", "_blank"); _global.SoundManager.PlaySound("button"); }
Symbol 91 MovieClip Frame 70
stop();
Symbol 93 MovieClip Frame 70
stop();
Symbol 98 Button
on (press) { gotoAndPlay ("main menu"); _global.SoundManager.PlaySound("button"); }
Symbol 100 MovieClip Frame 1
stop();
Symbol 100 MovieClip Frame 2
stop();
Symbol 119 Button
on (press) { _root.SelectLevel(this._name); }
Symbol 120 MovieClip Frame 1
stop();
Symbol 120 MovieClip Frame 2
stop();
Symbol 174 MovieClip Frame 1
stop();
Symbol 174 MovieClip Frame 15
stop();
Symbol 178 MovieClip Frame 1
stop();
Symbol 178 MovieClip Frame 2
stop();
Symbol 185 Button
on (release) { _root.Reset(); }
Symbol 189 Button
on (release) { _root.ExitGame(); }
Symbol 193 Button
on (release) { getURL ("http://www.armorgames.com", "_blank"); }
Symbol 194 MovieClip Frame 1
var r = Math.round(Math.random() * 5); var badMessage = "Whoops"; switch (r) { case 0 : badMessage = "Whoops"; break; case 1 : badMessage = "Sorry!"; break; case 2 : badMessage = "Oops!"; break; case 3 : badMessage = "Miss!"; break; case 4 : badMessage = "Too Bad..."; break; case 5 : badMessage = "Uh oh..."; } this.whoops.whoops_txt.text = badMessage;
Symbol 194 MovieClip Frame 15
stop();
Symbol 201 Button
on (release) { trace("got here"); _root.Next(); }
Symbol 202 MovieClip Frame 15
stop();
Symbol 203 MovieClip Frame 1
stop();
Symbol 203 MovieClip Frame 10
stop();
Symbol 203 MovieClip Frame 20
stop();
Symbol 206 Button
on (press) { gotoAndPlay ("splash"); }

Library Items

Symbol 1 GraphicUsed by:2
Symbol 2 MovieClip [particle 1]Uses:1
Symbol 3 GraphicUsed by:4
Symbol 4 MovieClip [partProject]Uses:3
Symbol 5 GraphicUsed by:6 98 206
Symbol 6 MovieClipUses:5Used by:7
Symbol 7 MovieClip [arrow]Uses:6
Symbol 8 GraphicUsed by:12
Symbol 9 GraphicUsed by:10
Symbol 10 MovieClipUses:9Used by:12 14 16 18 20 78
Symbol 11 GraphicUsed by:12 14 16 18 20 78
Symbol 12 MovieClip [Star - 3 triangle]Uses:8 10 11Used by:Timeline
Symbol 13 GraphicUsed by:14
Symbol 14 MovieClip [Star - 12 blast]Uses:13 10 11Used by:Timeline
Symbol 15 GraphicUsed by:16
Symbol 16 MovieClip [Star - 2  Back]Uses:15 10 11Used by:Timeline
Symbol 17 GraphicUsed by:18
Symbol 18 MovieClip [Star - 1 To 45 Right]Uses:17 10 11Used by:Timeline
Symbol 19 GraphicUsed by:20
Symbol 20 MovieClip [star 1]Uses:19 10 11Used by:Timeline
Symbol 21 GraphicUsed by:24
Symbol 22 GraphicUsed by:24
Symbol 23 GraphicUsed by:24
Symbol 24 MovieClip [shootingStar]Uses:21 22 23Used by:91 178
Symbol 25 GraphicUsed by:26
Symbol 26 MovieClipUses:25Used by:Timeline
Symbol 27 GraphicUsed by:75  Timeline
Symbol 28 GraphicUsed by:29
Symbol 29 MovieClipUses:28Used by:75  Timeline
Symbol 30 FontUsed by:31 94
Symbol 31 EditableTextUses:30Used by:32
Symbol 32 MovieClipUses:31Used by:Timeline
Symbol 33 FontUsed by:34 35 74 76 77 81 82 85 86 88 89 92 95 96 97 110 111 112 113 121 180 182 183 186 187 190 191 196 198 199 207 208
Symbol 34 EditableTextUses:33Used by:Timeline
Symbol 35 EditableTextUses:33Used by:Timeline
Symbol 36 GraphicUsed by:40
Symbol 37 GraphicUsed by:40
Symbol 38 GraphicUsed by:40
Symbol 39 GraphicUsed by:40
Symbol 40 MovieClipUses:36 37 38 39Used by:Timeline
Symbol 41 FontUsed by:42 43 44 45 46 214
Symbol 42 EditableTextUses:41Used by:Timeline
Symbol 43 EditableTextUses:41Used by:Timeline
Symbol 44 EditableTextUses:41Used by:Timeline
Symbol 45 EditableTextUses:41Used by:Timeline
Symbol 46 EditableTextUses:41Used by:Timeline
Symbol 215 MovieClip [__Packages.SoundPlayer]
Symbol 216 MovieClip [__Packages.Music]
Symbol 217 MovieClip [__Packages.Particle]
Symbol 218 MovieClip [__Packages.Vector]
Symbol 219 MovieClip [__Packages.Particle_5]
Symbol 220 MovieClip [__Packages.Particle_4]
Symbol 221 MovieClip [__Packages.Particle_3]
Symbol 222 MovieClip [__Packages.Particle_2]
Symbol 223 MovieClip [__Packages.Particle_1]
Symbol 47 GraphicUsed by:48
Symbol 48 MovieClipUses:47Used by:57
Symbol 49 GraphicUsed by:50
Symbol 50 ButtonUses:49Used by:57
Symbol 51 GraphicUsed by:52
Symbol 52 MovieClipUses:51Used by:57
Symbol 53 GraphicUsed by:54
Symbol 54 MovieClipUses:53Used by:57
Symbol 55 GraphicUsed by:56
Symbol 56 MovieClipUses:55Used by:57
Symbol 57 MovieClipUses:48 50 52 54 56 SS1Used by:61
Symbol 58 GraphicUsed by:60
Symbol 59 GraphicUsed by:60
Symbol 60 MovieClipUses:58 59Used by:61
Symbol 61 MovieClipUses:57 60Used by:Timeline
Symbol 62 GraphicUsed by:75
Symbol 63 GraphicUsed by:70
Symbol 64 GraphicUsed by:70
Symbol 65 GraphicUsed by:70
Symbol 66 GraphicUsed by:70
Symbol 67 GraphicUsed by:70
Symbol 68 GraphicUsed by:70
Symbol 69 GraphicUsed by:70
Symbol 70 MovieClipUses:63 64 65 66 67 68 69Used by:75  Timeline
Symbol 71 GraphicUsed by:75  Timeline
Symbol 72 BitmapUsed by:73
Symbol 73 GraphicUses:72Used by:75  Timeline
Symbol 74 TextUses:33Used by:75
Symbol 75 MovieClipUses:62 70 71 27 29 73 74Used by:Timeline
Symbol 76 TextUses:33Used by:80
Symbol 77 TextUses:33Used by:80
Symbol 78 MovieClipUses:10 11Used by:80 84 87 90 93  Timeline
Symbol 79 GraphicUsed by:80
Symbol 80 ButtonUses:76 77 78 79Used by:Timeline
Symbol 81 TextUses:33Used by:84
Symbol 82 TextUses:33Used by:84
Symbol 83 GraphicUsed by:84 87 90 98 206
Symbol 84 ButtonUses:81 82 78 83Used by:Timeline
Symbol 85 TextUses:33Used by:87
Symbol 86 TextUses:33Used by:87
Symbol 87 ButtonUses:85 86 78 83Used by:Timeline
Symbol 88 TextUses:33Used by:90
Symbol 89 TextUses:33Used by:90
Symbol 90 ButtonUses:88 89 78 83Used by:Timeline
Symbol 91 MovieClipUses:24Used by:93
Symbol 92 TextUses:33Used by:93
Symbol 93 MovieClipUses:91 92 78Used by:Timeline
Symbol 94 EditableTextUses:30Used by:Timeline
Symbol 95 TextUses:33Used by:98 206
Symbol 96 TextUses:33Used by:98 206
Symbol 97 TextUses:33Used by:98 206
Symbol 98 ButtonUses:95 96 83 97 5Used by:Timeline
Symbol 99 GraphicUsed by:100
Symbol 100 MovieClipUses:99Used by:Timeline
Symbol 101 FontUsed by:102 103 104 105 106 107 108 109 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
Symbol 102 TextUses:101Used by:Timeline
Symbol 103 TextUses:101Used by:Timeline
Symbol 104 TextUses:101Used by:Timeline
Symbol 105 TextUses:101Used by:Timeline
Symbol 106 TextUses:101Used by:Timeline
Symbol 107 TextUses:101Used by:Timeline
Symbol 108 TextUses:101Used by:Timeline
Symbol 109 TextUses:101Used by:Timeline
Symbol 110 TextUses:33Used by:Timeline
Symbol 111 TextUses:33Used by:Timeline
Symbol 112 EditableTextUses:33 175Used by:Timeline
Symbol 113 TextUses:33Used by:Timeline
Symbol 114 GraphicUsed by:Timeline
Symbol 115 GraphicUsed by:116
Symbol 116 MovieClipUses:115Used by:120
Symbol 117 GraphicUsed by:119
Symbol 118 GraphicUsed by:119
Symbol 119 ButtonUses:117 118Used by:120
Symbol 120 MovieClipUses:116 119Used by:Timeline
Symbol 121 TextUses:33Used by:Timeline
Symbol 122 TextUses:101Used by:Timeline
Symbol 123 TextUses:101Used by:Timeline
Symbol 124 TextUses:101Used by:Timeline
Symbol 125 TextUses:101Used by:Timeline
Symbol 126 TextUses:101Used by:Timeline
Symbol 127 TextUses:101Used by:Timeline
Symbol 128 TextUses:101Used by:Timeline
Symbol 129 TextUses:101Used by:Timeline
Symbol 130 TextUses:101Used by:Timeline
Symbol 131 TextUses:101Used by:Timeline
Symbol 132 TextUses:101Used by:Timeline
Symbol 133 TextUses:101Used by:Timeline
Symbol 134 TextUses:101Used by:Timeline
Symbol 135 TextUses:101Used by:Timeline
Symbol 136 TextUses:101Used by:Timeline
Symbol 137 TextUses:101Used by:Timeline
Symbol 138 TextUses:101Used by:Timeline
Symbol 139 TextUses:101Used by:Timeline
Symbol 140 TextUses:101Used by:Timeline
Symbol 141 TextUses:101Used by:Timeline
Symbol 142 TextUses:101Used by:Timeline
Symbol 143 TextUses:101Used by:Timeline
Symbol 144 TextUses:101Used by:Timeline
Symbol 145 TextUses:101Used by:Timeline
Symbol 146 TextUses:101Used by:Timeline
Symbol 147 TextUses:101Used by:Timeline
Symbol 148 TextUses:101Used by:Timeline
Symbol 149 TextUses:101Used by:Timeline
Symbol 150 TextUses:101Used by:Timeline
Symbol 151 TextUses:101Used by:Timeline
Symbol 152 TextUses:101Used by:Timeline
Symbol 153 TextUses:101Used by:Timeline
Symbol 154 TextUses:101Used by:Timeline
Symbol 155 TextUses:101Used by:Timeline
Symbol 156 TextUses:101Used by:Timeline
Symbol 157 TextUses:101Used by:Timeline
Symbol 158 TextUses:101Used by:Timeline
Symbol 159 TextUses:101Used by:Timeline
Symbol 160 TextUses:101Used by:Timeline
Symbol 161 TextUses:101Used by:Timeline
Symbol 162 TextUses:101Used by:Timeline
Symbol 163 TextUses:101Used by:Timeline
Symbol 164 TextUses:101Used by:Timeline
Symbol 165 TextUses:101Used by:Timeline
Symbol 166 TextUses:101Used by:Timeline
Symbol 167 TextUses:101Used by:Timeline
Symbol 168 TextUses:101Used by:Timeline
Symbol 169 TextUses:101Used by:Timeline
Symbol 170 TextUses:101Used by:Timeline
Symbol 171 TextUses:101Used by:Timeline
Symbol 172 GraphicUsed by:Timeline
Symbol 173 GraphicUsed by:174
Symbol 174 MovieClipUses:173Used by:Timeline
Symbol 175 FontUsed by:112 176 204 205 207
Symbol 176 TextUses:175Used by:Timeline
Symbol 177 GraphicUsed by:178
Symbol 178 MovieClipUses:177 24Used by:Timeline
Symbol 179 GraphicUsed by:181
Symbol 180 EditableTextUses:33Used by:181
Symbol 181 MovieClipUses:179 180Used by:194
Symbol 182 TextUses:33Used by:185
Symbol 183 TextUses:33Used by:185
Symbol 184 GraphicUsed by:185
Symbol 185 ButtonUses:182 183 184Used by:194
Symbol 186 TextUses:33Used by:189
Symbol 187 TextUses:33Used by:189
Symbol 188 GraphicUsed by:189
Symbol 189 ButtonUses:186 187 188Used by:194 202
Symbol 190 TextUses:33Used by:193
Symbol 191 TextUses:33Used by:193
Symbol 192 GraphicUsed by:193
Symbol 193 ButtonUses:190 191 192Used by:194 202
Symbol 194 MovieClipUses:181 185 189 193Used by:203
Symbol 195 GraphicUsed by:197
Symbol 196 TextUses:33Used by:197
Symbol 197 MovieClipUses:195 196Used by:202
Symbol 198 TextUses:33Used by:201
Symbol 199 TextUses:33Used by:201
Symbol 200 GraphicUsed by:201
Symbol 201 ButtonUses:198 199 200Used by:202
Symbol 202 MovieClipUses:197 201 189 193Used by:203
Symbol 203 MovieClipUses:194 202Used by:Timeline
Symbol 204 TextUses:175Used by:Timeline
Symbol 205 TextUses:175Used by:Timeline
Symbol 206 ButtonUses:95 96 83 97 5Used by:Timeline
Symbol 207 TextUses:175 33Used by:Timeline
Symbol 208 TextUses:33Used by:Timeline
Symbol 209 Sound [game]Used by:Timeline
Symbol 210 Sound [title]Used by:Timeline
Symbol 211 Sound [button]Used by:Timeline
Symbol 212 Sound [collect]Used by:Timeline
Symbol 213 Sound [all]Used by:Timeline
Symbol 214 EditableTextUses:41Used by:Timeline
Streaming Sound 1Used by:Symbol 57 MovieClip

Instance Names

"load_txt"Frame 1Symbol 34 EditableText
"loadStar"Frame 1Symbol 40 MovieClip
"low"Frame 12Symbol 100 MovieClip
"med"Frame 12Symbol 100 MovieClip
"high"Frame 12Symbol 100 MovieClip
"musicOn"Frame 12Symbol 100 MovieClip
"musicOff"Frame 12Symbol 100 MovieClip
"soundsOn"Frame 12Symbol 100 MovieClip
"soundsOff"Frame 12Symbol 100 MovieClip
"l1"Frame 16Symbol 120 MovieClip
"l2"Frame 16Symbol 120 MovieClip
"l3"Frame 16Symbol 120 MovieClip
"l4"Frame 16Symbol 120 MovieClip
"l8"Frame 16Symbol 120 MovieClip
"l9"Frame 16Symbol 120 MovieClip
"l10"Frame 16Symbol 120 MovieClip
"l5"Frame 16Symbol 120 MovieClip
"l6"Frame 16Symbol 120 MovieClip
"l7"Frame 16Symbol 120 MovieClip
"l11"Frame 16Symbol 120 MovieClip
"l12"Frame 16Symbol 120 MovieClip
"l13"Frame 16Symbol 120 MovieClip
"l14"Frame 16Symbol 120 MovieClip
"l18"Frame 16Symbol 120 MovieClip
"l19"Frame 16Symbol 120 MovieClip
"l20"Frame 16Symbol 120 MovieClip
"l15"Frame 16Symbol 120 MovieClip
"l16"Frame 16Symbol 120 MovieClip
"l17"Frame 16Symbol 120 MovieClip
"l21"Frame 16Symbol 120 MovieClip
"l22"Frame 16Symbol 120 MovieClip
"l23"Frame 16Symbol 120 MovieClip
"l24"Frame 16Symbol 120 MovieClip
"l28"Frame 16Symbol 120 MovieClip
"l29"Frame 16Symbol 120 MovieClip
"l30"Frame 16Symbol 120 MovieClip
"l25"Frame 16Symbol 120 MovieClip
"l26"Frame 16Symbol 120 MovieClip
"l27"Frame 16Symbol 120 MovieClip
"l31"Frame 16Symbol 120 MovieClip
"l32"Frame 16Symbol 120 MovieClip
"l33"Frame 16Symbol 120 MovieClip
"l34"Frame 16Symbol 120 MovieClip
"l38"Frame 16Symbol 120 MovieClip
"l39"Frame 16Symbol 120 MovieClip
"l40"Frame 16Symbol 120 MovieClip
"l35"Frame 16Symbol 120 MovieClip
"l36"Frame 16Symbol 120 MovieClip
"l37"Frame 16Symbol 120 MovieClip
"l41"Frame 16Symbol 120 MovieClip
"l42"Frame 16Symbol 120 MovieClip
"l43"Frame 16Symbol 120 MovieClip
"l44"Frame 16Symbol 120 MovieClip
"l48"Frame 16Symbol 120 MovieClip
"l49"Frame 16Symbol 120 MovieClip
"l50"Frame 16Symbol 120 MovieClip
"l45"Frame 16Symbol 120 MovieClip
"l46"Frame 16Symbol 120 MovieClip
"l47"Frame 16Symbol 120 MovieClip
"gameBackground"Frame 20Symbol 174 MovieClip
"d"Frame 20Symbol 20 MovieClip [star 1]
"projectile"Frame 20Symbol 178 MovieClip
"messages_mc"Frame 20Symbol 203 MovieClip
"b"Frame 25Symbol 20 MovieClip [star 1]
"h"Frame 25Symbol 20 MovieClip [star 1]
"k"Frame 25Symbol 20 MovieClip [star 1]
"j"Frame 25Symbol 20 MovieClip [star 1]
"projectile"Frame 25Symbol 178 MovieClip
"messages_mc"Frame 25Symbol 203 MovieClip
"gameBackground"Frame 30Symbol 174 MovieClip
"b"Frame 30Symbol 20 MovieClip [star 1]
"a"Frame 30Symbol 20 MovieClip [star 1]
"c"Frame 30Symbol 20 MovieClip [star 1]
"d"Frame 30Symbol 20 MovieClip [star 1]
"e"Frame 30Symbol 20 MovieClip [star 1]
"f"Frame 30Symbol 20 MovieClip [star 1]
"g"Frame 30Symbol 20 MovieClip [star 1]
"projectile"Frame 30Symbol 178 MovieClip
"messages_mc"Frame 30Symbol 203 MovieClip
"gameBackground"Frame 35Symbol 174 MovieClip
"f"Frame 35Symbol 20 MovieClip [star 1]
"e"Frame 35Symbol 20 MovieClip [star 1]
"g"Frame 35Symbol 20 MovieClip [star 1]
"j"Frame 35Symbol 20 MovieClip [star 1]
"i"Frame 35Symbol 20 MovieClip [star 1]
"h"Frame 35Symbol 20 MovieClip [star 1]
"a"Frame 35Symbol 20 MovieClip [star 1]
"b"Frame 35Symbol 20 MovieClip [star 1]
"c"Frame 35Symbol 20 MovieClip [star 1]
"d"Frame 35Symbol 20 MovieClip [star 1]
"projectile"Frame 35Symbol 178 MovieClip
"messages_mc"Frame 35Symbol 203 MovieClip
"a"Frame 40Symbol 20 MovieClip [star 1]
"e"Frame 40Symbol 18 MovieClip [Star - 1 To 45 Right]
"projectile"Frame 40Symbol 178 MovieClip
"messages_mc"Frame 40Symbol 203 MovieClip
"d"Frame 45Symbol 20 MovieClip [star 1]
"a"Frame 45Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 45Symbol 20 MovieClip [star 1]
"b"Frame 45Symbol 18 MovieClip [Star - 1 To 45 Right]
"f"Frame 45Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 45Symbol 18 MovieClip [Star - 1 To 45 Right]
"g"Frame 45Symbol 20 MovieClip [star 1]
"h"Frame 45Symbol 18 MovieClip [Star - 1 To 45 Right]
"projectile"Frame 45Symbol 178 MovieClip
"messages_mc"Frame 45Symbol 203 MovieClip
"c"Frame 50Symbol 18 MovieClip [Star - 1 To 45 Right]
"a"Frame 50Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 50Symbol 20 MovieClip [star 1]
"d"Frame 50Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 50Symbol 18 MovieClip [Star - 1 To 45 Right]
"h"Frame 50Symbol 20 MovieClip [star 1]
"i"Frame 50Symbol 20 MovieClip [star 1]
"j"Frame 50Symbol 20 MovieClip [star 1]
"projectile"Frame 50Symbol 178 MovieClip
"messages_mc"Frame 50Symbol 203 MovieClip
"c"Frame 55Symbol 20 MovieClip [star 1]
"b"Frame 55Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 55Symbol 20 MovieClip [star 1]
"e"Frame 55Symbol 20 MovieClip [star 1]
"a"Frame 55Symbol 20 MovieClip [star 1]
"i"Frame 55Symbol 20 MovieClip [star 1]
"j"Frame 55Symbol 18 MovieClip [Star - 1 To 45 Right]
"k"Frame 55Symbol 18 MovieClip [Star - 1 To 45 Right]
"projectile"Frame 55Symbol 178 MovieClip
"messages_mc"Frame 55Symbol 203 MovieClip
"b"Frame 60Symbol 20 MovieClip [star 1]
"a"Frame 60Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 60Symbol 20 MovieClip [star 1]
"d"Frame 60Symbol 20 MovieClip [star 1]
"e"Frame 60Symbol 18 MovieClip [Star - 1 To 45 Right]
"f"Frame 60Symbol 20 MovieClip [star 1]
"g"Frame 60Symbol 20 MovieClip [star 1]
"h"Frame 60Symbol 20 MovieClip [star 1]
"i"Frame 60Symbol 18 MovieClip [Star - 1 To 45 Right]
"projectile"Frame 60Symbol 178 MovieClip
"a"Frame 65Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 65Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 65Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 65Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 65Symbol 20 MovieClip [star 1]
"f"Frame 65Symbol 18 MovieClip [Star - 1 To 45 Right]
"g"Frame 65Symbol 18 MovieClip [Star - 1 To 45 Right]
"h"Frame 65Symbol 18 MovieClip [Star - 1 To 45 Right]
"j"Frame 65Symbol 20 MovieClip [star 1]
"k"Frame 65Symbol 20 MovieClip [star 1]
"a"Frame 70Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 70Symbol 16 MovieClip [Star - 2  Back]
"k"Frame 70Symbol 20 MovieClip [star 1]
"c"Frame 75Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 75Symbol 16 MovieClip [Star - 2  Back]
"a"Frame 75Symbol 20 MovieClip [star 1]
"d"Frame 75Symbol 20 MovieClip [star 1]
"e"Frame 75Symbol 20 MovieClip [star 1]
"f"Frame 75Symbol 20 MovieClip [star 1]
"g"Frame 75Symbol 20 MovieClip [star 1]
"h"Frame 75Symbol 20 MovieClip [star 1]
"i"Frame 75Symbol 20 MovieClip [star 1]
"c"Frame 80Symbol 16 MovieClip [Star - 2  Back]
"a"Frame 80Symbol 16 MovieClip [Star - 2  Back]
"e"Frame 80Symbol 16 MovieClip [Star - 2  Back]
"b"Frame 80Symbol 16 MovieClip [Star - 2  Back]
"d"Frame 80Symbol 16 MovieClip [Star - 2  Back]
"i"Frame 80Symbol 16 MovieClip [Star - 2  Back]
"h"Frame 80Symbol 16 MovieClip [Star - 2  Back]
"b"Frame 85Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 85Symbol 16 MovieClip [Star - 2  Back]
"a"Frame 85Symbol 20 MovieClip [star 1]
"c"Frame 85Symbol 20 MovieClip [star 1]
"e"Frame 85Symbol 20 MovieClip [star 1]
"g"Frame 85Symbol 20 MovieClip [star 1]
"h"Frame 85Symbol 20 MovieClip [star 1]
"i"Frame 85Symbol 18 MovieClip [Star - 1 To 45 Right]
"j"Frame 85Symbol 16 MovieClip [Star - 2  Back]
"k"Frame 85Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 90Symbol 20 MovieClip [star 1]
"a"Frame 90Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 90Symbol 16 MovieClip [Star - 2  Back]
"b"Frame 90Symbol 16 MovieClip [Star - 2  Back]
"d"Frame 90Symbol 20 MovieClip [star 1]
"f"Frame 90Symbol 20 MovieClip [star 1]
"g"Frame 90Symbol 20 MovieClip [star 1]
"h"Frame 90Symbol 20 MovieClip [star 1]
"i"Frame 90Symbol 20 MovieClip [star 1]
"j"Frame 90Symbol 16 MovieClip [Star - 2  Back]
"a"Frame 95Symbol 14 MovieClip [Star - 12 blast]
"b"Frame 95Symbol 14 MovieClip [Star - 12 blast]
"c"Frame 95Symbol 14 MovieClip [Star - 12 blast]
"a"Frame 100Symbol 16 MovieClip [Star - 2  Back]
"c"Frame 100Symbol 14 MovieClip [Star - 12 blast]
"i"Frame 100Symbol 20 MovieClip [star 1]
"g"Frame 100Symbol 20 MovieClip [star 1]
"b"Frame 100Symbol 18 MovieClip [Star - 1 To 45 Right]
"h"Frame 100Symbol 18 MovieClip [Star - 1 To 45 Right]
"j"Frame 100Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 100Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 100Symbol 18 MovieClip [Star - 1 To 45 Right]
"f"Frame 100Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 105Symbol 16 MovieClip [Star - 2  Back]
"a"Frame 105Symbol 12 MovieClip [Star - 3 triangle]
"b"Frame 105Symbol 20 MovieClip [star 1]
"c"Frame 105Symbol 18 MovieClip [Star - 1 To 45 Right]
"g"Frame 110Symbol 16 MovieClip [Star - 2  Back]
"d"Frame 110Symbol 12 MovieClip [Star - 3 triangle]
"e"Frame 110Symbol 20 MovieClip [star 1]
"f"Frame 110Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 110Symbol 18 MovieClip [Star - 1 To 45 Right]
"a"Frame 110Symbol 20 MovieClip [star 1]
"i"Frame 110Symbol 16 MovieClip [Star - 2  Back]
"h"Frame 115Symbol 16 MovieClip [Star - 2  Back]
"e"Frame 115Symbol 12 MovieClip [Star - 3 triangle]
"g"Frame 115Symbol 20 MovieClip [star 1]
"f"Frame 115Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 115Symbol 12 MovieClip [Star - 3 triangle]
"c"Frame 115Symbol 12 MovieClip [Star - 3 triangle]
"b"Frame 115Symbol 12 MovieClip [Star - 3 triangle]
"a"Frame 115Symbol 12 MovieClip [Star - 3 triangle]
"i"Frame 115Symbol 16 MovieClip [Star - 2  Back]
"j"Frame 115Symbol 20 MovieClip [star 1]
"k"Frame 115Symbol 14 MovieClip [Star - 12 blast]
"l"Frame 115Symbol 20 MovieClip [star 1]
"a"Frame 120Symbol 12 MovieClip [Star - 3 triangle]
"c"Frame 120Symbol 12 MovieClip [Star - 3 triangle]
"b"Frame 120Symbol 12 MovieClip [Star - 3 triangle]
"e"Frame 120Symbol 12 MovieClip [Star - 3 triangle]
"d"Frame 120Symbol 12 MovieClip [Star - 3 triangle]
"f"Frame 120Symbol 12 MovieClip [Star - 3 triangle]
"g"Frame 120Symbol 12 MovieClip [Star - 3 triangle]
"h"Frame 120Symbol 12 MovieClip [Star - 3 triangle]
"i"Frame 120Symbol 12 MovieClip [Star - 3 triangle]
"d"Frame 125Symbol 12 MovieClip [Star - 3 triangle]
"a"Frame 125Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 125Symbol 16 MovieClip [Star - 2  Back]
"b"Frame 125Symbol 20 MovieClip [star 1]
"c"Frame 125Symbol 20 MovieClip [star 1]
"f"Frame 125Symbol 12 MovieClip [Star - 3 triangle]
"g"Frame 125Symbol 20 MovieClip [star 1]
"h"Frame 125Symbol 18 MovieClip [Star - 1 To 45 Right]
"i"Frame 125Symbol 14 MovieClip [Star - 12 blast]
"j"Frame 125Symbol 14 MovieClip [Star - 12 blast]
"k"Frame 125Symbol 14 MovieClip [Star - 12 blast]
"a"Frame 130Symbol 16 MovieClip [Star - 2  Back]
"d"Frame 130Symbol 20 MovieClip [star 1]
"b"Frame 130Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 130Symbol 16 MovieClip [Star - 2  Back]
"g"Frame 130Symbol 20 MovieClip [star 1]
"e"Frame 130Symbol 20 MovieClip [star 1]
"f"Frame 130Symbol 20 MovieClip [star 1]
"h"Frame 130Symbol 20 MovieClip [star 1]
"a"Frame 135Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 135Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 135Symbol 16 MovieClip [Star - 2  Back]
"d"Frame 135Symbol 16 MovieClip [Star - 2  Back]
"f"Frame 135Symbol 20 MovieClip [star 1]
"e"Frame 135Symbol 16 MovieClip [Star - 2  Back]
"g"Frame 135Symbol 20 MovieClip [star 1]
"h"Frame 135Symbol 20 MovieClip [star 1]
"b"Frame 140Symbol 20 MovieClip [star 1]
"a"Frame 140Symbol 20 MovieClip [star 1]
"d"Frame 140Symbol 20 MovieClip [star 1]
"f"Frame 140Symbol 20 MovieClip [star 1]
"c"Frame 140Symbol 20 MovieClip [star 1]
"e"Frame 140Symbol 20 MovieClip [star 1]
"h"Frame 140Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 145Symbol 20 MovieClip [star 1]
"e"Frame 145Symbol 20 MovieClip [star 1]
"i"Frame 145Symbol 20 MovieClip [star 1]
"b"Frame 145Symbol 20 MovieClip [star 1]
"a"Frame 145Symbol 20 MovieClip [star 1]
"c"Frame 145Symbol 20 MovieClip [star 1]
"j"Frame 145Symbol 20 MovieClip [star 1]
"g"Frame 145Symbol 20 MovieClip [star 1]
"f"Frame 145Symbol 20 MovieClip [star 1]
"h"Frame 145Symbol 20 MovieClip [star 1]
"k"Frame 145Symbol 20 MovieClip [star 1]
"f"Frame 150Symbol 16 MovieClip [Star - 2  Back]
"c"Frame 150Symbol 20 MovieClip [star 1]
"b"Frame 150Symbol 20 MovieClip [star 1]
"d"Frame 150Symbol 20 MovieClip [star 1]
"e"Frame 150Symbol 12 MovieClip [Star - 3 triangle]
"a"Frame 150Symbol 20 MovieClip [star 1]
"g"Frame 150Symbol 16 MovieClip [Star - 2  Back]
"h"Frame 150Symbol 12 MovieClip [Star - 3 triangle]
"i"Frame 150Symbol 12 MovieClip [Star - 3 triangle]
"s"Frame 150Symbol 14 MovieClip [Star - 12 blast]
"f"Frame 155Symbol 16 MovieClip [Star - 2  Back]
"c"Frame 155Symbol 20 MovieClip [star 1]
"b"Frame 155Symbol 20 MovieClip [star 1]
"d"Frame 155Symbol 12 MovieClip [Star - 3 triangle]
"e"Frame 155Symbol 12 MovieClip [Star - 3 triangle]
"a"Frame 155Symbol 20 MovieClip [star 1]
"g"Frame 155Symbol 16 MovieClip [Star - 2  Back]
"h"Frame 155Symbol 12 MovieClip [Star - 3 triangle]
"i"Frame 155Symbol 12 MovieClip [Star - 3 triangle]
"s"Frame 155Symbol 14 MovieClip [Star - 12 blast]
"c"Frame 160Symbol 20 MovieClip [star 1]
"b"Frame 160Symbol 20 MovieClip [star 1]
"d"Frame 160Symbol 12 MovieClip [Star - 3 triangle]
"a"Frame 160Symbol 20 MovieClip [star 1]
"i"Frame 160Symbol 14 MovieClip [Star - 12 blast]
"a"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"b"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"c"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"d"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"e"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"f"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"m"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"h"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"i"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"j"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"k"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"g"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"l"Frame 165Symbol 16 MovieClip [Star - 2  Back]
"c"Frame 170Symbol 16 MovieClip [Star - 2  Back]
"a"Frame 170Symbol 16 MovieClip [Star - 2  Back]
"b"Frame 170Symbol 20 MovieClip [star 1]
"d"Frame 170Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 170Symbol 16 MovieClip [Star - 2  Back]
"f"Frame 170Symbol 18 MovieClip [Star - 1 To 45 Right]
"g"Frame 170Symbol 20 MovieClip [star 1]
"k"Frame 170Symbol 18 MovieClip [Star - 1 To 45 Right]
"l"Frame 170Symbol 18 MovieClip [Star - 1 To 45 Right]
"a"Frame 175Symbol 16 MovieClip [Star - 2  Back]
"c"Frame 175Symbol 20 MovieClip [star 1]
"d"Frame 175Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 175Symbol 12 MovieClip [Star - 3 triangle]
"e"Frame 175Symbol 20 MovieClip [star 1]
"f"Frame 175Symbol 16 MovieClip [Star - 2  Back]
"g"Frame 175Symbol 12 MovieClip [Star - 3 triangle]
"h"Frame 175Symbol 14 MovieClip [Star - 12 blast]
"i"Frame 175Symbol 14 MovieClip [Star - 12 blast]
"m"Frame 175Symbol 16 MovieClip [Star - 2  Back]
"d"Frame 180Symbol 20 MovieClip [star 1]
"e"Frame 180Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 180Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 180Symbol 18 MovieClip [Star - 1 To 45 Right]
"a"Frame 180Symbol 20 MovieClip [star 1]
"f"Frame 180Symbol 20 MovieClip [star 1]
"g"Frame 180Symbol 20 MovieClip [star 1]
"h"Frame 180Symbol 20 MovieClip [star 1]
"i"Frame 180Symbol 18 MovieClip [Star - 1 To 45 Right]
"j"Frame 180Symbol 20 MovieClip [star 1]
"k"Frame 180Symbol 18 MovieClip [Star - 1 To 45 Right]
"l"Frame 180Symbol 20 MovieClip [star 1]
"m"Frame 180Symbol 20 MovieClip [star 1]
"n"Frame 180Symbol 18 MovieClip [Star - 1 To 45 Right]
"o"Frame 180Symbol 18 MovieClip [Star - 1 To 45 Right]
"p"Frame 180Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 185Symbol 20 MovieClip [star 1]
"a"Frame 185Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 185Symbol 16 MovieClip [Star - 2  Back]
"d"Frame 185Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 185Symbol 16 MovieClip [Star - 2  Back]
"f"Frame 185Symbol 16 MovieClip [Star - 2  Back]
"g"Frame 185Symbol 12 MovieClip [Star - 3 triangle]
"h"Frame 185Symbol 12 MovieClip [Star - 3 triangle]
"i"Frame 185Symbol 18 MovieClip [Star - 1 To 45 Right]
"j"Frame 185Symbol 14 MovieClip [Star - 12 blast]
"n"Frame 185Symbol 18 MovieClip [Star - 1 To 45 Right]
"k"Frame 185Symbol 18 MovieClip [Star - 1 To 45 Right]
"l"Frame 185Symbol 18 MovieClip [Star - 1 To 45 Right]
"m"Frame 185Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 190Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 190Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 190Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 190Symbol 18 MovieClip [Star - 1 To 45 Right]
"a"Frame 190Symbol 20 MovieClip [star 1]
"f"Frame 190Symbol 14 MovieClip [Star - 12 blast]
"g"Frame 190Symbol 14 MovieClip [Star - 12 blast]
"h"Frame 190Symbol 16 MovieClip [Star - 2  Back]
"i"Frame 190Symbol 18 MovieClip [Star - 1 To 45 Right]
"j"Frame 190Symbol 18 MovieClip [Star - 1 To 45 Right]
"k"Frame 190Symbol 18 MovieClip [Star - 1 To 45 Right]
"l"Frame 190Symbol 18 MovieClip [Star - 1 To 45 Right]
"c"Frame 195Symbol 20 MovieClip [star 1]
"t"Frame 195Symbol 12 MovieClip [Star - 3 triangle]
"q"Frame 195Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 195Symbol 20 MovieClip [star 1]
"e"Frame 195Symbol 20 MovieClip [star 1]
"f"Frame 195Symbol 20 MovieClip [star 1]
"g"Frame 195Symbol 20 MovieClip [star 1]
"h"Frame 195Symbol 20 MovieClip [star 1]
"i"Frame 195Symbol 20 MovieClip [star 1]
"j"Frame 195Symbol 20 MovieClip [star 1]
"k"Frame 195Symbol 20 MovieClip [star 1]
"l"Frame 195Symbol 20 MovieClip [star 1]
"m"Frame 195Symbol 20 MovieClip [star 1]
"n"Frame 195Symbol 20 MovieClip [star 1]
"o"Frame 195Symbol 20 MovieClip [star 1]
"p"Frame 195Symbol 20 MovieClip [star 1]
"a"Frame 195Symbol 20 MovieClip [star 1]
"b"Frame 195Symbol 20 MovieClip [star 1]
"r"Frame 195Symbol 18 MovieClip [Star - 1 To 45 Right]
"s"Frame 195Symbol 20 MovieClip [star 1]
"u"Frame 195Symbol 12 MovieClip [Star - 3 triangle]
"y"Frame 195Symbol 16 MovieClip [Star - 2  Back]
"z"Frame 195Symbol 20 MovieClip [star 1]
"w"Frame 195Symbol 20 MovieClip [star 1]
"x"Frame 195Symbol 20 MovieClip [star 1]
"v"Frame 195Symbol 20 MovieClip [star 1]
"b"Frame 200Symbol 18 MovieClip [Star - 1 To 45 Right]
"a"Frame 200Symbol 20 MovieClip [star 1]
"c"Frame 200Symbol 16 MovieClip [Star - 2  Back]
"d"Frame 200Symbol 12 MovieClip [Star - 3 triangle]
"e"Frame 200Symbol 20 MovieClip [star 1]
"f"Frame 200Symbol 16 MovieClip [Star - 2  Back]
"g"Frame 200Symbol 18 MovieClip [Star - 1 To 45 Right]
"i"Frame 200Symbol 12 MovieClip [Star - 3 triangle]
"h"Frame 200Symbol 20 MovieClip [star 1]
"b"Frame 205Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 205Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 205Symbol 18 MovieClip [Star - 1 To 45 Right]
"a"Frame 205Symbol 20 MovieClip [star 1]
"h"Frame 205Symbol 16 MovieClip [Star - 2  Back]
"i"Frame 205Symbol 18 MovieClip [Star - 1 To 45 Right]
"j"Frame 205Symbol 14 MovieClip [Star - 12 blast]
"k"Frame 205Symbol 18 MovieClip [Star - 1 To 45 Right]
"l"Frame 205Symbol 18 MovieClip [Star - 1 To 45 Right]
"z"Frame 205Symbol 20 MovieClip [star 1]
"b"Frame 210Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 210Symbol 18 MovieClip [Star - 1 To 45 Right]
"a"Frame 210Symbol 20 MovieClip [star 1]
"h"Frame 210Symbol 16 MovieClip [Star - 2  Back]
"i"Frame 210Symbol 18 MovieClip [Star - 1 To 45 Right]
"j"Frame 210Symbol 14 MovieClip [Star - 12 blast]
"k"Frame 210Symbol 16 MovieClip [Star - 2  Back]
"l"Frame 210Symbol 18 MovieClip [Star - 1 To 45 Right]
"z"Frame 210Symbol 16 MovieClip [Star - 2  Back]
"b"Frame 215Symbol 18 MovieClip [Star - 1 To 45 Right]
"e"Frame 215Symbol 18 MovieClip [Star - 1 To 45 Right]
"a"Frame 215Symbol 20 MovieClip [star 1]
"h"Frame 215Symbol 16 MovieClip [Star - 2  Back]
"i"Frame 215Symbol 18 MovieClip [Star - 1 To 45 Right]
"j"Frame 215Symbol 14 MovieClip [Star - 12 blast]
"k"Frame 215Symbol 16 MovieClip [Star - 2  Back]
"l"Frame 215Symbol 18 MovieClip [Star - 1 To 45 Right]
"z"Frame 215Symbol 16 MovieClip [Star - 2  Back]
"t"Frame 215Symbol 16 MovieClip [Star - 2  Back]
"p"Frame 215Symbol 20 MovieClip [star 1]
"b"Frame 220Symbol 20 MovieClip [star 1]
"c"Frame 220Symbol 16 MovieClip [Star - 2  Back]
"e"Frame 220Symbol 20 MovieClip [star 1]
"d"Frame 220Symbol 20 MovieClip [star 1]
"f"Frame 220Symbol 16 MovieClip [Star - 2  Back]
"h"Frame 220Symbol 16 MovieClip [Star - 2  Back]
"b"Frame 225Symbol 20 MovieClip [star 1]
"a"Frame 225Symbol 16 MovieClip [Star - 2  Back]
"c"Frame 225Symbol 16 MovieClip [Star - 2  Back]
"e"Frame 225Symbol 20 MovieClip [star 1]
"d"Frame 225Symbol 20 MovieClip [star 1]
"f"Frame 225Symbol 18 MovieClip [Star - 1 To 45 Right]
"h"Frame 225Symbol 16 MovieClip [Star - 2  Back]
"y"Frame 225Symbol 16 MovieClip [Star - 2  Back]
"d"Frame 230Symbol 20 MovieClip [star 1]
"c"Frame 230Symbol 20 MovieClip [star 1]
"b"Frame 230Symbol 20 MovieClip [star 1]
"a"Frame 230Symbol 20 MovieClip [star 1]
"e"Frame 230Symbol 16 MovieClip [Star - 2  Back]
"g"Frame 230Symbol 20 MovieClip [star 1]
"f"Frame 230Symbol 20 MovieClip [star 1]
"h"Frame 230Symbol 16 MovieClip [Star - 2  Back]
"i"Frame 230Symbol 16 MovieClip [Star - 2  Back]
"j"Frame 230Symbol 16 MovieClip [Star - 2  Back]
"l"Frame 230Symbol 16 MovieClip [Star - 2  Back]
"m"Frame 230Symbol 16 MovieClip [Star - 2  Back]
"b"Frame 235Symbol 20 MovieClip [star 1]
"a"Frame 235Symbol 20 MovieClip [star 1]
"c"Frame 235Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 235Symbol 20 MovieClip [star 1]
"e"Frame 235Symbol 20 MovieClip [star 1]
"f"Frame 235Symbol 20 MovieClip [star 1]
"b"Frame 240Symbol 20 MovieClip [star 1]
"a"Frame 240Symbol 20 MovieClip [star 1]
"c"Frame 240Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 240Symbol 14 MovieClip [Star - 12 blast]
"e"Frame 240Symbol 20 MovieClip [star 1]
"f"Frame 240Symbol 20 MovieClip [star 1]
"y"Frame 240Symbol 18 MovieClip [Star - 1 To 45 Right]
"z"Frame 240Symbol 18 MovieClip [Star - 1 To 45 Right]
"x"Frame 240Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 245Symbol 20 MovieClip [star 1]
"a"Frame 245Symbol 16 MovieClip [Star - 2  Back]
"c"Frame 245Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 245Symbol 14 MovieClip [Star - 12 blast]
"e"Frame 245Symbol 20 MovieClip [star 1]
"f"Frame 245Symbol 20 MovieClip [star 1]
"y"Frame 245Symbol 18 MovieClip [Star - 1 To 45 Right]
"z"Frame 245Symbol 18 MovieClip [Star - 1 To 45 Right]
"x"Frame 245Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 250Symbol 12 MovieClip [Star - 3 triangle]
"a"Frame 250Symbol 16 MovieClip [Star - 2  Back]
"c"Frame 250Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 250Symbol 14 MovieClip [Star - 12 blast]
"e"Frame 250Symbol 20 MovieClip [star 1]
"f"Frame 250Symbol 20 MovieClip [star 1]
"y"Frame 250Symbol 18 MovieClip [Star - 1 To 45 Right]
"z"Frame 250Symbol 18 MovieClip [Star - 1 To 45 Right]
"x"Frame 250Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 255Symbol 12 MovieClip [Star - 3 triangle]
"a"Frame 255Symbol 16 MovieClip [Star - 2  Back]
"c"Frame 255Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 255Symbol 14 MovieClip [Star - 12 blast]
"e"Frame 255Symbol 20 MovieClip [star 1]
"f"Frame 255Symbol 20 MovieClip [star 1]
"y"Frame 255Symbol 18 MovieClip [Star - 1 To 45 Right]
"z"Frame 255Symbol 18 MovieClip [Star - 1 To 45 Right]
"x"Frame 255Symbol 18 MovieClip [Star - 1 To 45 Right]
"b"Frame 260Symbol 12 MovieClip [Star - 3 triangle]
"a"Frame 260Symbol 16 MovieClip [Star - 2  Back]
"e"Frame 260Symbol 12 MovieClip [Star - 3 triangle]
"f"Frame 260Symbol 20 MovieClip [star 1]
"y"Frame 260Symbol 18 MovieClip [Star - 1 To 45 Right]
"x"Frame 260Symbol 12 MovieClip [Star - 3 triangle]
"p"Frame 260Symbol 18 MovieClip [Star - 1 To 45 Right]
"s"Frame 260Symbol 18 MovieClip [Star - 1 To 45 Right]
"r"Frame 260Symbol 16 MovieClip [Star - 2  Back]
"i"Frame 265Symbol 20 MovieClip [star 1]
"j"Frame 265Symbol 18 MovieClip [Star - 1 To 45 Right]
"d"Frame 265Symbol 16 MovieClip [Star - 2  Back]
"f"Frame 265Symbol 18 MovieClip [Star - 1 To 45 Right]
"m"Frame 265Symbol 16 MovieClip [Star - 2  Back]
"h"Frame 265Symbol 20 MovieClip [star 1]
"e"Frame 265Symbol 16 MovieClip [Star - 2  Back]
"g"Frame 265Symbol 20 MovieClip [star 1]
"l"Frame 265Symbol 16 MovieClip [Star - 2  Back]
"o"Frame 265Symbol 16 MovieClip [Star - 2  Back]
"b"Frame 265Symbol 16 MovieClip [Star - 2  Back]
"n"Frame 265Symbol 16 MovieClip [Star - 2  Back]
"k"Frame 265Symbol 16 MovieClip [Star - 2  Back]
"a"Frame 265Symbol 16 MovieClip [Star - 2  Back]
"whoops_txt"Symbol 181 MovieClip Frame 1Symbol 180 EditableText
"whoops"Symbol 194 MovieClip Frame 1Symbol 181 MovieClip

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS1/AS2.
ExportAssets (56)Timeline Frame 1Symbol 2 as "particle 1"
ExportAssets (56)Timeline Frame 1Symbol 4 as "partProject"
ExportAssets (56)Timeline Frame 1Symbol 7 as "arrow"
ExportAssets (56)Timeline Frame 1Symbol 12 as "Star - 3 triangle"
ExportAssets (56)Timeline Frame 1Symbol 14 as "Star - 12 blast"
ExportAssets (56)Timeline Frame 1Symbol 16 as "Star - 2  Back"
ExportAssets (56)Timeline Frame 1Symbol 18 as "Star - 1 To 45 Right"
ExportAssets (56)Timeline Frame 1Symbol 20 as "star 1"
ExportAssets (56)Timeline Frame 1Symbol 24 as "shootingStar"
ExportAssets (56)Timeline Frame 1Symbol 215 as "__Packages.SoundPlayer"
ExportAssets (56)Timeline Frame 1Symbol 216 as "__Packages.Music"
ExportAssets (56)Timeline Frame 1Symbol 217 as "__Packages.Particle"
ExportAssets (56)Timeline Frame 1Symbol 218 as "__Packages.Vector"
ExportAssets (56)Timeline Frame 1Symbol 219 as "__Packages.Particle_5"
ExportAssets (56)Timeline Frame 1Symbol 220 as "__Packages.Particle_4"
ExportAssets (56)Timeline Frame 1Symbol 221 as "__Packages.Particle_3"
ExportAssets (56)Timeline Frame 1Symbol 222 as "__Packages.Particle_2"
ExportAssets (56)Timeline Frame 1Symbol 223 as "__Packages.Particle_1"
ExportAssets (56)Timeline Frame 276Symbol 209 as "game"
ExportAssets (56)Timeline Frame 277Symbol 210 as "title"
ExportAssets (56)Timeline Frame 278Symbol 211 as "button"
ExportAssets (56)Timeline Frame 279Symbol 212 as "collect"
ExportAssets (56)Timeline Frame 280Symbol 213 as "all"

Labels

"preload"Frame 1
"ads"Frame 5
"splash"Frame 6
"main menu"Frame 10
"settings"Frame 12
"credits"Frame 14
"level select"Frame 16
"level1"Frame 20
"loadSounds"Frame 275
"doneStored"Frame 285
"broke"Frame 295
"off"Symbol 100 MovieClip Frame 1
"on"Symbol 100 MovieClip Frame 2
"locked"Symbol 120 MovieClip Frame 1
"unlocked"Symbol 120 MovieClip Frame 2
"show"Symbol 174 MovieClip Frame 1
"hide"Symbol 174 MovieClip Frame 2
"hide"Symbol 203 MovieClip Frame 1
"retry"Symbol 203 MovieClip Frame 10
"next"Symbol 203 MovieClip Frame 20




http://swfchan.com/5/22790/info.shtml
Created: 26/5 -2019 17:08:57 Last modified: 26/5 -2019 17:08:57 Server time: 14/11 -2024 22:46:10