Frame 1
function check_domain() {
if (_root._url.indexOf("kongregate.com") > -1) {
_global.kongregate_site = true;
} else if (_root._url.indexOf("ourworld.com") > -1) {
_global.ow_site = true;
} else if (_root._url.indexOf("flowplay.com") > -1) {
_global.ow_site = true;
}
}
_global.ow_site = false;
_global.kongregate_site = false;
check_domain();
startGameCounter = 0;
var framesLoaded = this.getBytesLoaded();
var totalFrames = this.getBytesTotal();
var percentLoaded2 = int(((framesLoaded - 382031) / (totalFrames - 382031)) * 100);
loadingScreen.loadingTxt = percentLoaded2 + " %";
loadingScreen.gotoAndStop(percentLoaded2 / 2);
if (_root._url.indexOf("kongregate.com") == -1) {
if (_root._url.indexOf("ourworld.com") == -1) {
if (_root._url.indexOf("flowplay.com") == -1) {
var CPMStarContentSpotID = "95QFDBFD473";
System.security.allowDomain("server.cpmstar.com");
adBox.loadMovie("http://server.cpmstar.com/adviewas2.swf?contentspotid=" + CPMStarContentSpotID);
}
}
}
loadingScreen.stop();
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;
var pv;
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);
}
pv = ((fv == 5) ? (getVersion()) : (System.capabilities.version));
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=8&fv=") + fv) + "&v=") + escape(pv)) + "&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__("2d0d8622", this, 10301, true);
sounds = new Object();
sounds.fire = new Sound();
sounds.fire.attachSound("takeoff");
sounds.planet = new Sound();
sounds.planet.attachSound("planet");
sounds.fireMissile = new Sound();
sounds.fireMissile.attachSound("Missile");
saucerObject = new Sound(this.createEmptyMovieClip("snd2", 1002));
saucerObject.attachSound("SaucerLoop");
saucerObject.setVolume(50);
musicObject = new Sound(this.createEmptyMovieClip("snd", 1000));
musicObject.attachSound("music");
musicObject.setVolume(50);
sounds.doh = new Sound();
sounds.doh.attachSound("doh");
sounds.cheer = new Sound();
sounds.cheer.attachSound("cheer");
sounds.ohno = new Sound();
sounds.ohno.attachSound("ohno");
sounds.land = new Sound();
sounds.land.attachSound("land");
sounds.extraPoints = new Sound();
sounds.extraPoints.attachSound("bonusx4");
sounds.levelComplete = new Sound();
sounds.levelComplete.attachSound("GainLife");
sounds.Explosion = new Sound();
sounds.Explosion.attachSound("explosion");
sounds.GameOverRobot = new Sound();
sounds.GameOverRobot.attachSound("gameoverFx");
sounds.Appear = new Sound();
sounds.Appear.attachSound("Appear");
sounds.GotSaucer = new Sound();
sounds.GotSaucer.attachSound("GotSaucer");
sounds.enterGame = new Sound();
sounds.enterGame.attachSound("entergame");
Frame 3
if (framesLoaded == totalFrames) {
gotoAndPlay ("display_ad");
} else {
gotoAndPlay ("loop");
}
Frame 5
if (startGameCounter == 80) {
if (_global.kongregate_site == false) {
if (_global.ow_site == false) {
gotoAndStop ("show_btn");
} else {
gotoAndStop ("start_game");
}
} else {
gotoAndStop ("start_game");
}
} else {
startGameCounter++;
gotoAndPlay ("display_ad");
}
Frame 8
stop();
musicObject.start(0, 1000);
var asteroidFrame = 4;
var sunFrame = 3;
var sunMass = 40;
var enemies1 = new Array();
var enemies2 = new Array();
var enemies3 = new Array();
var enemies4 = new Array();
var enemies5 = new Array();
var enemies6 = new Array();
var enemies7 = new Array();
var enemies8 = new Array();
var enemies9 = new Array("alien");
var enemies10 = new Array();
var enemies11 = new Array();
var enemies12 = new Array("alien");
var enemies13 = new Array();
var enemies14 = new Array("alien");
var enemies15 = new Array("alien");
var enemies = new Array(enemies1, enemies2, enemies3, enemies4, enemies5, enemies6, enemies7, enemies8, enemies9, enemies10, enemies11, enemies12, enemies13, enemies14, enemies15, enemies16, enemies17, enemies18, enemies19, enemies20);
var numberToComplete = new Array(13, 4, 6, 5, 5, 6, 2, 6, 6, 5, 5, 4, 5, 5, 5, 6, 8, 9, 10, 11, 12);
var numberOfObstacles = new Array(25, 4, 6, 5, 5, 6, 2, 6, 5, 4, 5, 3, 3, 3, 2, 2, 4, 4, 4, 4, 5);
var numberOfObstacles2 = new Array(25, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7);
var numberOfSuns = new Array(0, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 5, 3, 3, 2, 3, 1, 2, 2, 2, 2);
var numberOfAsteroids = new Array(0, 0, 0, 1, 3, 5, 8, 2, 3, 4, 5, 4, 5, 5, 5, 6, 9, 2, 2, 2, 2);
function setupGame() {
Game = new GameGame(gameMc, this, 736, 576, 138, 32, startLives);
Presentation = new GamePresentation(this);
Presentation.setupSplashScreen(splashScreenElements);
this.onEnterFrame = mainLoop;
}
function runSounds() {
if (soundFade == "out") {
soundFadeControl = soundFadeControl - 2;
musicObject.setVolume(soundFadeControl);
if (soundFadeControl == 0) {
soundSwitch = "off";
soundFade = "done";
}
} else if (soundFade == "in") {
soundFadeControl = soundFadeControl + 2;
musicObject.setVolume(soundFadeControl);
if (soundFadeControl >= 50) {
soundSwitch = "on";
soundFade = "done";
}
}
}
function quitGame() {
obj.vx = 0;
obj.vy = 0;
Player.gun = Player.mC.attachMovie("arrow1", "TurretMc", 1);
obj.clip.removeMovieClip();
Game.msgMc.removeMovieClip();
Game.oxygenLevel = 100;
Game.gameState = "game_over_restart";
}
function clearSprites() {
var _local3 = Game.missilesArray.length - 1;
var _local1 = _local3;
while (_local1 >= 0) {
Game.missilesArray[_local1].remove();
_local1--;
}
var _local2 = Game.enemyArray.length - 1;
_local1 = _local2;
while (_local1 >= 0) {
Game.enemyArray[_local1].remove();
_local1--;
}
}
function updateScore() {
FlowPlayAPI.SetScore(Game.score);
FlowPlayAPI.SetLevel(Game.levelNumber);
FlowPlayAPI.StartReporting();
}
function setScore() {
FlowPlayAPI.SetScore(Game.score);
FlowPlayAPI.SetScore(Game.levelNumber);
}
function stopReporting() {
FlowPlayAPI.StopReporting();
}
function sendStat(statType, statValue, statGood) {
flash.external.ExternalInterface.call("fpSendStat", statType, statValue, statGood);
}
function mainLoop() {
runSounds();
if (Game.gameState == "setup") {
clearSprites();
Game.setupGerms();
Player = new GamePlayer(Game.playerMc, this, 300, 300);
Player.findPlanetToStart();
Game.setupEnemies();
Game.clockDelay = 20;
Presentation.splashScreenMc.removeMovieClip();
Game.saucerChance = 50;
Game.saucerDelay = -1;
if (Useful1.RandomNumber(1, 100) < (Game.saucerChance + Game.levelNumber)) {
Game.saucerDelay = Useful1.RandomNumber(50, 400);
}
Game.msgMc = Game.inGameMsgsMc.attachMovie("getReadyMsgAnim", "getready", 1);
Game.msgMc._x = Game.movieWidth / 2;
Game.msgMc._y = (Game.movieHeight / 2) - 40;
obj.vx = 3;
obj.vy = 0;
obj.x = Game.xPlayerStart;
obj.y = Game.yPlayerStart;
Game.minutes = Game.StartTimer;
Game.sec = 0;
Game.oxygenLevel = 100;
Game.setOxygen();
Game.displayTime();
Game.goodGuysArray.splice(0);
Game.sizeTarget = numberToComplete[Game.levelNumber];
Game.lives = startLives;
Game.setLives();
Game.setTarget();
Game.setScore();
Game.setLevel();
if (musicPlaying == "off") {
Game.turnMusicOff();
} else {
Game.turnMusicOn();
}
updateScore();
Game.gameState = "pre_start";
} else if (Game.gameState == "start_new_level") {
Game.levelNumber++;
clearSprites();
Game.setupGerms();
Game.clockDelay = 20;
Player.findPlanetToStart();
Game.enemyArray.splice(0);
Game.setupEnemies();
Game.saucerChance = 60;
Game.saucerDelay = -1;
if (Useful1.RandomNumber(1, 100) < (Game.saucerChance + Game.levelNumber)) {
Game.saucerDelay = Useful1.RandomNumber(50, 200);
}
Game.sizeTarget = numberToComplete[Game.levelNumber];
Game.msgMc = Game.inGameMsgsMc.attachMovie("getReadyMsgAnim", "getready", 1);
Game.msgMc._x = Game.movieWidth / 2;
Game.msgMc._y = (Game.movieHeight / 2) - 40;
obj.vx = 3;
obj.vy = 0;
Game.minutes = Game.StartTimer;
Game.sec = 0;
Game.displayTime();
Game.bonusCountArray.splice(0);
Game.lives = startLives;
Game.setLives();
Game.setTarget();
Game.setScore();
Game.setLevel();
updateScore();
Game.gameState = "pre_start";
} else if (Game.gameState == "restart") {
Game.score = 0;
Game.setScore();
updateScore();
Game.gameState = "pre_start";
} else if (Game.gameState == "game_over_restart") {
Game.resetMcs();
clearSprites();
Game.enemyArray.splice(0);
Game.clockDelay = 20;
Game.oxygenLevel = 100;
Game.setOxygen();
Game.resetMcs();
Presentation.setupSplashScreen(splashScreenElements);
Game.score = 0;
Game.levelNumber = 1;
Game.bonusCountArray.splice(0);
Game.saucerChance = 50;
Game.saucerDelay = -1;
if (Useful1.RandomNumber(1, 100) < (Game.saucerChance + Game.levelNumber)) {
Game.saucerDelay = Useful1.RandomNumber(50, 400);
}
updateScore();
Game.gameState = "waiting_to_start";
} else if (Game.gameState == "pre_start") {
Game.mainLoop();
} else if (Game.gameState == "start_game") {
Game.mainLoop();
} else if (Game.gameState == "display_bonus") {
Player.gun.monkey.frames.gotoAndStop("stand");
bonusCountDelay--;
if (bonusCountDelay == 0) {
bonusCountDelay = 1;
if (Game.timeBonus > Game.currentTimeBonus) {
Game.currentTimeBonus++;
Game.msgMc.msg.timeBonus.text = ("+" + Game.currentTimeBonus) + "x10";
Game.score = Game.score + 10;
Game.setScore();
} else {
Game.msgMc.msg.totalScore.text = Game.score;
Game.setScore();
Game.msgMc.play();
}
}
} else if (Game.gameState == "play") {
Game.mainLoop();
}
}
function setupGoodGuy(mCName, xStart, yStart, grav, rg) {
var _local3 = Game.inGameObjectsMc.attachMovie(mCName, "gg" + Game.numberOfDropped, Game.numberOfDropped);
var _local2 = Useful1.RandomNumber(5, 10);
_local2 = _local2 / 10;
Game.goodGuysArray.push(new GoodGuy(_local3, this, xStart, yStart, _local2, mCName, grav, rg));
}
function setupPickups() {
var _local3 = 0;
while (_local3 < Game.levelHeightBlocks) {
var _local1 = 0;
while (_local1 < Game.levelWidthBlocks) {
var _local2 = (_local3 * Game.levelWidthBlocks) + _local1;
if ((_local3 == 0) or (_local3 == (Game.levelHeightBlocks - 3))) {
squareNamesArray[_local2] = "edgeSquare";
} else if ((_local1 == 0) or (_local1 == (Game.levelWidthBlocks - 1))) {
squareNamesArray[_local2] = "edgeSquare";
} else {
squareNamesArray[_local2] = "square";
}
_local1++;
}
_local3++;
}
}
function setupPanel() {
ix = 0;
iy = 0;
ii = 0;
var _local2 = 0;
while (_local2 < gameObjectNames.length) {
var _local1 = Game.inGameStatsMc.ingamestatsmc;
_local1 = _local1.wg;
_local1 = _local1["w" + (_local2 + 1)];
_local1 = _local1.wb;
Game.rightPanelGameObjects[_local2] = _local1;
Game.rightPanelGameObjects[_local2].indexA = _local2;
Game.rightPanelGameObjects[_local2].gameObjectBtn.onRelease = clickRightPanelObject;
Game.rightPanelGameObjects[_local2].gameObjectBtn.onRollOver = rollOverRightPanelObject;
Game.rightPanelGameObjects[_local2].gameObjectBtn.onRollOut = rollOutRightPanelObject;
_local2++;
}
}
function clickRightPanelObject() {
Game.currentPickedUp = mousePointer.attachMovie(rightPanelGameObjectNames[this._parent.indexA], "pickedup", 1);
if (gameObjectRange[this._parent.indexA] != 0) {
rangeCircle = mousePointer.attachMovie(gameObjectRange[this._parent.indexA], "range", 0);
rangeCircle._x = rangeCircle._x + (blockSize / 2);
rangeCircle._y = rangeCircle._y + (blockSize / 2);
} else {
removeMovieClip(rangeCircle);
}
Game.currentPickedUp.indexA = this._parent.indexA;
}
function rollOverRightPanelObject() {
}
function rollOutRightPanelObject() {
}
function dropGameObject() {
var _local4 = _xmouse;
var _local3 = _ymouse;
if (Game.currentPickedUp != undefined) {
if (checkIfOverLapping() == true) {
var _local5 = 0;
var _local2 = gameObjectCost[Game.currentPickedUp.indexA];
var _local1 = Game.score;
_local1 = _local1 - _local2;
if (_local1 >= 0) {
setupGoodGuy("magnet1", _local4, _local3, 0.7, 100);
if (rt.gameObjectNames[currentPickedUp.indexA] != "magnet") {
}
Game.numberOfDropped++;
}
}
}
}
function checkIfOverLapping() {
if ((_xmouse > (736 - blockSize)) or (_xmouse < blockSize)) {
return(false);
}
return(true);
}
var gameMc = this.createEmptyMovieClip("gameMc", 0);
var Useful1 = new Useful();
var Player;
var scrollOff = 0;
var startReal = true;
var Game;
var Presentation;
var Player;
var Background;
var Wave;
var SoundClass;
var parallaxLayersNames = new Array();
obj = {x:ball._x, y:ball._y, vx:3, vy:0};
var xLevelStart = 0;
var yLevelStart = -2100;
var ballMc;
var squareNamesArray = new Array();
var mousePointer = this.attachMovie("crosshair", "crosshair", 50);
mousePointer.yOld = 0;
var bonusCountDelay = 1;
var splashScreenElements = ["playInfo", "instructionsInfo", "controlsInfo", "highscoresInfo", "SplashMusicBtn"];
var startLives = 3000;
keyboard = new Object();
var PLAYER_STATUS = "";
keyboard.onKeyDown = function () {
};
keyboard.onKeyUp = function () {
if (Key.getCode() == 80) {
if (Game.pauseSwitch == false) {
if (Game.gameState == "play") {
Game.pauseOn();
}
} else {
Game.pauseOff();
}
}
};
Key.addListener(keyboard);
var distantPointX = 0;
var distantPointY = 0;
var newDistance = 0;
mousePointer.onEnterFrame = function () {
this._x = _xmouse;
yOld = this._y;
this._y = _ymouse;
};
var mouseButton = false;
this.onMouseUp = function () {
mouseButton = false;
};
this.onMouseDown = function () {
mouseButton = true;
};
var soundControl = 1;
var soundFade;
var soundFadeControl = 50;
soundMc.soundBtn.onRelease = function () {
if (soundControl == 0) {
soundControl = 1;
soundFade = "in";
soundMc.soundControlMc.gotoAndStop(1);
} else {
soundControl = 0;
soundFade = "out";
soundMc.soundControlMc.gotoAndStop(2);
}
};
var soundSwitch = "on";
var musicPlaying = "on";
var rightPanelGameObjectNames = new Array("gameObject4", "gameObject3", "gameObject1", "gameObject2", "gameObject5", "gameObject1", "gameObject1", "gameObject1", "gameObject1");
var gameObjectNames = new Array("moneyDrop", "manWithBat", "tower1", "redTurret", "blueTurret", "spaceMine", "blueForceField", "towerBase", "towerBase", "towerBase", "towerBase");
var gameObjectCost = Array(1, 10, 20, 15, 5, 4, 3, 2, 1);
var gameObjectRange = Array("shortRangeCircle", "longRangeCircle", 0, 0, 0, 0, 0, 0);
setupGame();
setupPanel();
var blockSize = 32;
stop();
Symbol 18 MovieClip [points] Frame 21
this.removeMovieClip();
Symbol 52 MovieClip Frame 1
submitBtn.onRelease = function () {
gotoAndStop ("submit");
};
score.text = _root.Game.score;
stop();
quitBtn.onRelease = function () {
_root.quitGame();
};
Symbol 52 MovieClip Frame 2
function moveOn() {
_root.quitGame();
}
mochi.MochiScores.showLeaderboard({boardID:_root.leaderboardID, clip:_root, score:_root.Game.score, onClose:moveOn, onError:moveOn});
stop();
Symbol 52 MovieClip Frame 3
_root.quitGame();
Symbol 53 MovieClip [endScreen] Frame 1
play();
Symbol 57 MovieClip Frame 1
stop();
Symbol 57 MovieClip Frame 5
stop();
Symbol 68 MovieClip Frame 1
stop();
Symbol 68 MovieClip Frame 9
stop();
Symbol 70 MovieClip Frame 1
stop();
Symbol 70 MovieClip Frame 9
stop();
Symbol 75 MovieClip Frame 6
stop();
Symbol 79 MovieClip [sun] Frame 1
stop();
Symbol 79 MovieClip [sun] Frame 5
stop();
Symbol 87 MovieClip [asteroid1] Frame 1
stop();
Symbol 87 MovieClip [asteroid1] Frame 8
_parent._parent.asteroid = "done";
stop();
Symbol 88 MovieClip Frame 1
stop();
Symbol 91 MovieClip [badBall] Frame 1
stop();
Symbol 98 MovieClip Frame 1
stop();
Symbol 98 MovieClip Frame 10
gotoAndStop (1);
Symbol 109 MovieClip [ballCharacter] Frame 1
stop();
Symbol 155 MovieClip [spaceMonkey] Frame 1
stop();
Symbol 198 MovieClip [M_stars1] Frame 15
this.removeMovieClip();
Symbol 199 MovieClip [starAnim] Frame 1
i = 1;
heart.onEnterFrame = function () {
if (_currentframe != 13) {
myMovie = heart.duplicateMovieClip("heart" + i, i);
myMovie._rotation = Math.random() * 360;
myMovie._xscale = scale;
myMovie._yscale = scale;
scale = (Math.random() * 80) + 20;
i++;
}
};
Symbol 199 MovieClip [starAnim] Frame 24
this.removeMovieClip();
stop();
Symbol 202 MovieClip Frame 1
play();
Symbol 205 MovieClip Frame 1
submitBtn.onRelease = function () {
gotoAndStop ("submit");
};
score.text = _parent._parent._parent._parent._parent._parent._parent.Game.score;
stop();
quitBtn.onRelease = function () {
_parent._parent._parent._parent._parent._parent._parent.quitGame();
};
Symbol 205 MovieClip Frame 2
function moveOn() {
_parent._parent.play();
}
mochi.MochiScores.showLeaderboard({boardID:"5cddab50731501b9", clip:_root, score:_parent._parent._parent._parent._parent._parent._parent.Game.score, onClose:moveOn, onError:moveOn});
stop();
Symbol 205 MovieClip Frame 3
_parent._parent.play();
Symbol 207 MovieClip [gameOverMsgAnim] Frame 64
stop();
Symbol 207 MovieClip [gameOverMsgAnim] Frame 77
_parent._parent._parent._parent._parent.Game.gameState = "game_over_restart";
stop();
Symbol 213 MovieClip Frame 1
stop();
Symbol 217 MovieClip Frame 1
stop();
Symbol 219 MovieClip [loseLifeMsgAnim] Frame 48
if (_parent._parent._parent._parent._parent.Game.gameState != "restart") {
_parent._parent._parent._parent._parent.Game.gameState = "restart";
}
this.removeMovieClip();
Symbol 225 MovieClip [getReadyMsgAnim] Frame 1
msg.sizeTarget.text = _parent._parent._parent._parent._parent.Game.sizeTarget;
Symbol 225 MovieClip [getReadyMsgAnim] Frame 23
msg.sizeTarget.text = _parent._parent._parent._parent._parent.Game.sizeTarget;
Symbol 225 MovieClip [getReadyMsgAnim] Frame 86
_parent._parent._parent._parent._parent.Game.gameState = "play";
this.removeMovieClip();
Symbol 233 MovieClip [levelCompleteMsgs] Frame 1
stop();
Symbol 235 MovieClip [levelCompleteMsgAnim] Frame 15
msg.titleMc.gotoAndStop(howWellDone);
Symbol 235 MovieClip [levelCompleteMsgAnim] Frame 31
_parent._parent._parent._parent._parent.Game.gameState = "display_bonus";
_parent._parent._parent._parent._parent.sounds.levelComplete.start(0, 1);
stop();
Symbol 235 MovieClip [levelCompleteMsgAnim] Frame 81
_parent._parent._parent._parent._parent.Game.gameState = "start_new_level";
stop();
Symbol 239 MovieClip [pausedMsgAnim] Frame 33
stop();
Symbol 239 MovieClip [pausedMsgAnim] Frame 42
this.removeMovieClip();
Symbol 247 MovieClip [CannonManRoll] Frame 1
stop();
Symbol 253 MovieClip [bullet] Frame 1
stop();
Symbol 259 MovieClip Frame 256
_parent.myObject.mCDeath();
Symbol 301 MovieClip Frame 1
stop();
Symbol 301 MovieClip Frame 13
myObject.fireNow();
Symbol 309 MovieClip Frame 1
stop();
Symbol 315 MovieClip [mainface] Frame 1
stop();
Symbol 319 MovieClip [goldLostAnim] Frame 16
this.removeMovieClip();
Symbol 324 MovieClip [square] Frame 1
stop();
Symbol 336 MovieClip Frame 1
stop();
Symbol 362 MovieClip [man with pistol anim] Frame 1
stop();
Symbol 378 MovieClip Frame 1
stop();
Symbol 450 Button
on (release) {
getURL ("http://www.flashgamemaker.com", _blank);
}
Symbol 457 MovieClip Frame 1
owBtn.onRelease = function () {
getURL ("http://www.ourworld.com/v11/tracking?source=game&id=fglspacemonkey", "_blank");
};
Symbol 464 MovieClip [SplashScreen] Frame 1
Symbol 464 MovieClip [SplashScreen] Frame 61
stop();
Symbol 496 MovieClip [splashInfo] Frame 1
stop();
Symbol 496 MovieClip [splashInfo] Frame 2
stop();
backBtn.onRelease = function () {
_root.Presentation.setupPresentationElements2();
gotoAndStop (1);
};
Symbol 496 MovieClip [splashInfo] Frame 3
backBtn.onRelease = function () {
_root.Presentation.setupPresentationElements2();
gotoAndStop (1);
};
Symbol 496 MovieClip [splashInfo] Frame 4
function moveOn() {
_root.Presentation.setupPresentationElements2();
gotoAndStop (1);
}
backBtn.onRelease = function () {
_root.mochi.MochiScores.closeLeaderboard();
this._parent.mochi.MochiScores.closeLeaderboard();
moveOn();
};
var leaderBoardMc = this.createEmptyMovieClip("leaderBoard", 1);
leaderBoardMc._x = -360;
leaderBoardMc._y = -200;
mochi.MochiScores.showLeaderboard({boardID:"5cddab50731501b9", clip:leaderBoardMc, onClose:moveOn, onError:moveOn});
stop();
Symbol 512 MovieClip Frame 1
stop();
Symbol 515 MovieClip Frame 1
stop();
Symbol 518 MovieClip Frame 1
stop();
Instance of Symbol 512 MovieClip in Symbol 533 MovieClip [bgIsland] Frame 1
onClipEvent (load) {
d = _parent._parent._parent.RandomNumber(10, 100);
}
onClipEvent (enterFrame) {
if (_currentframe == 1) {
d--;
if (d == 0) {
d = _parent._parent._parent.RandomNumber(10, 150);
play();
}
}
}
Instance of Symbol 515 MovieClip in Symbol 533 MovieClip [bgIsland] Frame 1
onClipEvent (load) {
d = _parent._parent._parent.RandomNumber(10, 100);
}
onClipEvent (enterFrame) {
if (_currentframe == 1) {
d--;
if (d == 0) {
d = _parent._parent._parent.RandomNumber(10, 150);
play();
}
}
}
Instance of Symbol 518 MovieClip in Symbol 533 MovieClip [bgIsland] Frame 1
onClipEvent (load) {
d = _parent._parent._parent.RandomNumber(10, 100);
}
onClipEvent (enterFrame) {
if (_currentframe == 1) {
d--;
if (d == 0) {
d = _parent._parent._parent.RandomNumber(10, 150);
play();
}
}
}
Instance of Symbol 512 MovieClip in Symbol 541 MovieClip [backgroundDesertToBeach] Frame 1
onClipEvent (load) {
d = _parent._parent._parent.RandomNumber(10, 100);
}
onClipEvent (enterFrame) {
if (_currentframe == 1) {
d--;
if (d == 0) {
d = _parent._parent._parent.RandomNumber(10, 150);
play();
}
}
}
Instance of Symbol 515 MovieClip in Symbol 541 MovieClip [backgroundDesertToBeach] Frame 1
onClipEvent (load) {
d = _parent._parent._parent.RandomNumber(10, 100);
}
onClipEvent (enterFrame) {
if (_currentframe == 1) {
d--;
if (d == 0) {
d = _parent._parent._parent.RandomNumber(10, 150);
play();
}
}
}
Instance of Symbol 518 MovieClip in Symbol 541 MovieClip [backgroundDesertToBeach] Frame 1
onClipEvent (load) {
d = _parent._parent._parent.RandomNumber(10, 100);
}
onClipEvent (enterFrame) {
if (_currentframe == 1) {
d--;
if (d == 0) {
d = _parent._parent._parent.RandomNumber(10, 150);
play();
}
}
}
Symbol 547 MovieClip [balloonMaskGradient] Frame 1
stop();
Symbol 549 MovieClip [balloonMaskMc] Frame 1
stop();
Symbol 553 MovieClip [balloon] Frame 1
maskMc.setMask(balloonMaskMc);
stop();
Symbol 553 MovieClip [balloon] Frame 5
this.removeMovieClip();
Symbol 559 MovieClip [bonusMc1] Frame 16
this.removeMovieClip();
Symbol 564 MovieClip [bonusMc2] Frame 16
this.removeMovieClip();
Symbol 569 MovieClip [bonusMc3] Frame 16
this.removeMovieClip();
Symbol 574 MovieClip [bonusMc4] Frame 16
this.removeMovieClip();
Symbol 583 MovieClip [flySaucer] Frame 1
stop();
Symbol 588 MovieClip [bonusMc1000] Frame 16
this.removeMovieClip();
Symbol 594 MovieClip Frame 1
stop();
Symbol 597 MovieClip [SplashMusicBtn] Frame 1
if (_root.musicPlaying == "off") {
musicMc.gotoAndStop(2);
}
musicBtn.onRelease = function () {
if (musicMc._currentframe == 1) {
this._parent._parent._parent._parent._parent._parent._parent._parent.soundFade = "out";
this._parent._parent._parent._parent._parent._parent._parent._parent.musicPlaying = "off";
musicMc.gotoAndStop(2);
} else {
this._parent._parent._parent._parent._parent._parent._parent._parent.soundFade = "in";
this._parent._parent._parent._parent._parent._parent._parent._parent.musicPlaying = "on";
musicMc.gotoAndStop(1);
}
};
Symbol 627 MovieClip [SplashScreenButtonsAnim] Frame 105
stop();
Symbol 652 MovieClip [OWSplashScreen] Frame 1
owBtn.onRelease = function () {
getURL ("http://www.ourworld.com/v11/tracking?source=game&id=fglspacemonkey", "_blank");
};
Symbol 652 MovieClip [OWSplashScreen] Frame 157
_parent.gotoAndStop("start_game");
Symbol 665 MovieClip [__Packages.mochi.MochiScores] Frame 0
class mochi.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.MochiScores.boardID = boardID;
mochi.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
if (options.clip != null) {
if (options.clip.__mochiservicesMC != mochi.MochiServices.__get__clip()) {
mochi.MochiServices.disconnect();
mochi.MochiServices.connect(mochi.MochiServices.__get__id(), options.clip);
}
delete options.clip;
}
if (options.onDisplay != null) {
options.onDisplay();
} else {
mochi.MochiServices.__get__clip().stop();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
if (mochi.MochiServices.__get__clip() == _root.__mochiservicesMC) {
mochi.MochiServices.__get__clip()._parent.gameOverMc.play();
} else {
mochi.MochiServices.__get__clip().gameOverMc.play();
}
};
}
if (options.onError != null) {
onError = options.onError;
} else {
onError = onClose;
}
if (options.boardID == null) {
if (boardID != null) {
options.boardID = boardID;
}
}
mochi.MochiServices.send("scores_showLeaderboard", {options:options}, null, doClose);
}
static function getPlayerInfo(callbackObj, callbackMethod) {
mochi.MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
static function submit(score, name, callbackObj, callbackMethod) {
mochi.MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
static function requestList(callbackObj, callbackMethod) {
mochi.MochiServices.send("scores_requestList", null, callbackObj, callbackMethod);
}
static function doClose(args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = "IOError";
}
onError.apply(null, [args.errorCode]);
} else {
onClose.apply();
}
}
}
Symbol 666 MovieClip [__Packages.mochi.MochiServices] Frame 0
class mochi.MochiServices
{
static var _id, _container, _sendChannelName, _rcvChannelName, __get__comChannelName, onError, _listenChannel, _rcvChannel, _loader, _loaderListener, _sendChannel;
function MochiServices () {
}
static function get id() {
return(_id);
}
static function get clip() {
return(_container);
}
static function getVersion() {
return("1.2");
}
static function allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function get isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function set comChannelName(val) {
if (val != undefined) {
if (val.length > 3) {
_sendChannelName = val + "_fromgame";
_rcvChannelName = val;
initComChannels();
}
}
//return(__get__comChannelName());
}
static function get connected() {
return(_connected);
}
static function connect(id, clip, onError) {
if ((!_connected) && (_container == undefined)) {
_connecting = true;
init(id, clip);
}
if (onError != undefined) {
mochi.MochiServices.onError = onError;
} else if (mochi.MochiServices.onError == undefined) {
mochi.MochiServices.onError = function (errorCode) {
};
}
}
static function disconnect() {
if (_connected || (_connecting)) {
_connecting = (_connected = false);
flush(true);
if (_container != undefined) {
_container.removeMovieClip();
delete _container;
}
_listenChannel.close();
_rcvChannel.close();
}
}
static function init(id, clip) {
_id = id;
if (clip != undefined) {
_container = clip.createEmptyMovieClip("__mochiservicesMC", clip.getNextHighestDepth());
} else {
_container = _root.createEmptyMovieClip("__mochiservicesMC", _root.getNextHighestDepth());
}
loadCommunicator(id, _container);
}
static function loadCommunicator(id, clip) {
if (!isNetworkAvailable) {
return(undefined);
}
allowDomains(_gatewayURL);
_loader = new MovieClipLoader();
if (_loaderListener.waitInterval != null) {
clearInterval(_loaderListener.waitInterval);
}
_loaderListener = {};
_loaderListener.onLoadError = function (target_mc, errorCode, httpStatus) {
mochi.MochiServices.disconnect();
mochi.MochiServices.onError.apply(null, [errorCode]);
};
_loaderListener.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_loaderListener.startTime = getTimer();
_loaderListener.wait = function () {
if ((getTimer() - this.startTime) > 10000) {
if (!this.isLoading) {
mochi.MochiServices.disconnect();
mochi.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_loaderListener.waitInterval = setInterval(_loaderListener, "wait", 1000);
_loader.addListener(_loaderListener);
_loader.loadClip(_gatewayURL, clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain = function (d) {
return(true);
};
_rcvChannel.allowInsecureDomain = _rcvChannel.allowDomain;
_rcvChannel._nextcallbackID = 0;
_rcvChannel._callbacks = {};
listen();
}
static function onStatus(infoObject) {
if (!(infoObject.level === "error")) {
} else {
_connected = false;
_listenChannel.connect(_listenChannelName);
}
}
static function listen() {
_listenChannel = new LocalConnection();
_listenChannel.handshake = function (args) {
mochi.MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel.connect(_listenChannelName);
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
mochi.MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()});
_rcvChannel.onStatus = function (infoObject) {
mochi.MochiServices.onStatus(infoObject);
};
_rcvChannel.onReceive = function (pkg) {
var _local5 = pkg.callbackID;
var _local4 = this._callbacks[_local5];
if (!_local4) {
return(undefined);
}
var _local2 = _local4.callbackMethod;
var _local3 = _local4.callbackObject;
if (_local3 && (typeof(_local2) == "string")) {
_local2 = _local3[_local2];
}
if (_local2 != undefined) {
_local2.apply(_local3, pkg.args);
}
delete this._callbacks[_local5];
};
_rcvChannel.onError = function () {
mochi.MochiServices.onError.apply(null, ["IOError"]);
};
_rcvChannel.connect(_rcvChannelName);
_connecting = false;
_connected = true;
_listenChannel.close();
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function flush(error) {
var _local1;
var _local2;
while (_sendChannel._queue.length > 0) {
_local1 = _sendChannel._queue.shift();
if (_local1.callbackID != null) {
_local2 = _rcvChannel._callbacks[_local1.callbackID];
}
delete _rcvChannel._callbacks[_local1.callbackID];
if (error) {
handleError(_local1.args, _local2.callbackObject, _local2.callbackMethod);
}
}
}
static function handleError(args, callbackObject, callbackMethod) {
if (args != null) {
if (args.onError != null) {
args.onError.apply(null, ["NotConnected"]);
}
}
if (callbackMethod != null) {
args = {};
args.error = true;
args.errorCode = "NotConnected";
if ((callbackObject != null) && (typeof(callbackMethod) == "string")) {
callbackObject[callbackMethod](args);
} else if (callbackMethod != null) {
callbackMethod.apply(args);
}
}
}
static function send(methodName, args, callbackObject, callbackMethod) {
if (_connected) {
_sendChannel.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_rcvChannel._nextcallbackID});
} else {
if ((_container == undefined) || (!_connecting)) {
onError.apply(null, ["NotConnected"]);
handleError(args, callbackObject, callbackMethod);
flush(true);
return(undefined);
}
_sendChannel._queue.push({methodName:methodName, args:args, callbackID:_rcvChannel._nextcallbackID});
}
_rcvChannel._callbacks[_rcvChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_rcvChannel._nextcallbackID++;
}
static var _gatewayURL = "http://www.mochiads.com/static/lib/services/services.swf";
static var _listenChannelName = "__mochiservices";
static var _connecting = false;
static var _connected = false;
}
Symbol 667 MovieClip [__Packages.GamePlayer] Frame 0
class GamePlayer
{
var missileDistFromGun, root, shotsFired, shotsLimit, mouseOldX, mouseOldY, numberOfMissiles, scrollSpeed, keypress, jumpTime, mouseButton, planetIndex, oldRotation, mC, shotStrength, playerState, vectorData, oxygenIncreaseDelay, gun, spriteData;
function GamePlayer (clip, rt, xStart, yStart) {
missileDistFromGun = 40;
xOrigin = xStart;
yOrigin = yStart;
dx = 0;
root = rt;
dy = 0;
angle = 0;
shotsFired = 0;
shotsLimit = 2;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
xVelOld = 0;
mouseOldX = 0;
mouseOldY = 0;
numberOfMissiles = 0;
yVelOld = 0;
scrollSpeed = 10;
keypress = 0;
jump = 0;
jumpTime = 10;
mouseButton = 0;
planetIndex = 0;
oldRotation = 0;
mC = clip;
shotStrength = 6;
playerState = "standing";
vectorData = new Object();
oxygenIncreaseDelay = 10;
gun = mC.attachMovie("arrow1", "TurretMc", 1);
updatePosition();
}
function findPlanetToStart() {
var _local2 = 0;
while (_local2 < root.Game.badGuysArray.length) {
var _local3 = root.Game.badGuysArray[_local2];
if (_local3.mass != root.sunMass) {
if (_local3.bubble._currentframe != root.asteroidFrame) {
planetIndex = _local2;
_local2 = root.Game.badGuysArray.length;
}
}
_local2++;
}
xOrigin = root.Game.badGuysArray[planetIndex]._x;
yOrigin = root.Game.badGuysArray[planetIndex]._y;
updatePosition();
}
function checkForEnemy(possiblePlanet) {
var _local3 = false;
var _local2 = 0;
while (_local2 < root.Game.enemyArray.length) {
if (root.Game.enemyArray[_local2].planetIndex == possiblePlanet) {
_local3 = true;
}
_local2++;
}
return(_local3);
}
function resetToPlanet() {
playerState = "standing";
gun.monkey.frames.gotoAndStop("standing");
gun.monkey.frames._rotation = -90;
gun.monkey._rotation = 0;
var _local2 = root.Game.inGameScoreMc.attachMovie("points", "points" + root.Game.starAnims, root.Game.starAnims + 1000);
_local2._x = mC._x - (xVel * 5);
_local2._y = mC._y - (yVel * 5);
root.Game.starAnims++;
_local2.txt.pointsTxt.text = -5;
root.Game.decreaseOxygen(5);
xVel = 0;
yVel = 0;
xPos = 0;
yPos = 0;
}
function mainLoop() {
var _local16 = mouseOldX - _xmouse;
var _local17 = mouseOldY - _ymouse;
if (playerState == "flying") {
root.Game.distanceTraveledSpace++;
oxygenIncreaseDelay--;
if (oxygenIncreaseDelay == 0) {
oxygenIncreaseDelay = 4;
root.Game.decreaseOxygen(1);
}
gun.monkey.frames.gotoAndStop("flying");
updatePosition();
var _local3 = 0;
while (_local3 < root.Game.badGuysArray.length) {
var _local9 = root.Game.badGuysArray[_local3];
if (_local9.mass == root.sunMass) {
var _local11 = root.Useful1.getDistance(mC._x - vectorData.xPos, mC._y - vectorData.yPos, _local9._x, _local9._y);
if (_local11 < 60) {
oxygenIncreaseDelay--;
if (oxygenIncreaseDelay == 0) {
oxygenIncreaseDelay = 4;
root.Game.decreaseOxygen(1);
}
}
} else if (_local9.mass == 100) {
var _local11 = root.Useful1.getDistance(mC._x - vectorData.xPos, mC._y - vectorData.yPos, _local9._x, _local9._y);
if (_local11 < 60) {
xVel = xVel / 1.06;
yVel = yVel / 1.06;
}
} else if (gun.monkey.hitTest(_local9)) {
if (_local9.bubble._currentframe == root.asteroidFrame) {
if (_local9.bubble.asteroid1._currentframe == 1) {
root.Game.asteroidsDestroyed++;
_local9.bubble.asteroid1.play();
root.sounds.Explosion.start(0, 1);
}
} else if (planetIndex != _local3) {
if (checkForEnemy(_local3) == false) {
root.sounds.land.start(0, 1);
planetIndex = _local3;
playerState = "standing";
gun.monkey.frames.gotoAndStop("standing");
xVel = 0;
yVel = 0;
xPos = 0;
yPos = 0;
gun.monkey.frames._rotation = -90;
gun.monkey._rotation = 0;
}
}
}
var _local6 = xPos + xVel;
var _local7 = yPos + yVel;
var _local4 = xOrigin + _local6;
var _local5 = yOrigin + _local7;
if (_local4 > root.Game.rightEdge) {
resetToPlanet();
} else if (_local4 < 0) {
resetToPlanet();
}
if (_local5 > root.Game.bottomEdge) {
resetToPlanet();
} else if (_local5 < 0) {
var _local8 = root.Game.bottomEdge - yOrigin;
resetToPlanet();
}
_local3++;
}
} else {
if (root.mouseButton == false) {
if (playerState == "dragging") {
playerState = "flying";
root.sounds.fire.start(0, 1);
root.Game.inGameContainerMc.clear();
var _local11 = root.Useful1.getDistance(mC._x - vectorData.xPos, mC._y - vectorData.yPos, root._xmouse, root._ymouse);
_local11 = _local11 / 20;
if (_local11 < 6) {
_local11 = 6;
}
spriteData = root.Useful1.pointTowards(root._xmouse, root._ymouse, mC._x - vectorData.xPos, mC._y - vectorData.yPos);
xVel = spriteData.vx * _local11;
yVel = spriteData.vy * _local11;
gun.monkey.frames._rotation = (spriteData.spriteRotation - mC._rotation) + 90;
} else {
oxygenIncreaseDelay--;
if (oxygenIncreaseDelay == 0) {
oxygenIncreaseDelay = 10;
root.Game.increaseOxygen(1);
}
xOrigin = root.Game.badGuysArray[planetIndex]._x;
yOrigin = root.Game.badGuysArray[planetIndex]._y;
spriteData = root.Useful1.pointTowards(mC._x, mC._y, root._xmouse, root._ymouse);
oldRotation = mC._rotation;
mC._rotation = spriteData.spriteRotation;
if ((_local16 != 0) or (_local17 != 0)) {
if (oldRotation > mC._rotation) {
gun.monkey.frames.gotoAndStop("runLeft");
} else if (oldRotation < mC._rotation) {
gun.monkey.frames.gotoAndStop("runRight");
}
} else {
gun.monkey.frames.gotoAndStop("stand");
}
var _local9 = root.Game.badGuysArray[planetIndex];
_local9 = _local9.bubble.surface;
var _local3 = 0;
while (_local3 < 16) {
if (_local9["s" + (_local3 + 1)].done == 0) {
if (gun.monkey.hitTest(_local9["s" + (_local3 + 1)])) {
_local9["s" + (_local3 + 1)].gotoAndPlay(2);
_local9["s" + (_local3 + 1)].done = 1;
}
} else if (_local9["s" + (_local3 + 1)]._currentframe == 2) {
_local9["s" + (_local3 + 1)].play();
}
_local3++;
}
var _local10 = 0;
_local9 = root.Game.badGuysArray[planetIndex];
_local9 = _local9.bubble.surface;
_local3 = 0;
while (_local3 < 16) {
if (_local9["s" + (_local3 + 1)].done != 0) {
_local10++;
}
_local3++;
}
if (_local10 == 16) {
if (root.Game.badGuysArray[planetIndex].done == 0) {
root.Game.badGuysArray[planetIndex].done = 1;
root.sounds.planet.start(0, 1);
var _local13 = root.Game.badGuysArray[planetIndex];
_local13 = _local13.bubble;
_local13.surface.gotoAndPlay(2);
_local13.planetA.gotoAndPlay(2);
root.Game.sizeTarget--;
}
}
}
} else {
xOrigin = root.Game.badGuysArray[planetIndex]._x;
yOrigin = root.Game.badGuysArray[planetIndex]._y;
if (playerState == "standing") {
var _local12 = root.Game.inGameStatsMc.ingamestatsmc;
_local12 = _local12.wg;
_local12 = _local12.stats;
if (_local12.playerBtn.hitTest(_root._xmouse, _root._ymouse) == false) {
mouseOldX = _xmouse;
mouseOldY = _ymouse;
playerState = "dragging";
gun.monkey.frames.gotoAndStop("flying");
}
} else {
vectorData = root.Useful1.rotateXY(0, 0, 40, mC._rotation);
var _local14 = vectorData.xPos;
var _local15 = vectorData.yPos;
root.Game.inGameContainerMc.clear();
root.Game.inGameContainerMc.lineStyle(3, 16737843, 100);
root.Game.inGameContainerMc.moveTo(mC._x - _local14, mC._y - _local15);
root.Game.inGameContainerMc.lineTo(root._xmouse, root._ymouse);
}
}
updatePosition();
}
mouseOldX = _xmouse;
mouseOldY = _ymouse;
}
function fireGun(xStart, yStart, vx, vy, myParent) {
var _local2 = "bullet";
var _local3 = root.Game.inGameMissilesMc.attachMovie(_local2, "missile" + numberOfMissiles, numberOfMissiles);
numberOfMissiles++;
root.Game.missilesArray.push(new Missile2(_local3, xStart, yStart, root, _local2, vx, vy, myParent));
root.Game.missilesArray[root.Game.missilesArray.length - 1].updatePosition();
}
function PlayerControl(scr, KeyCheck, Coll, scrollObjects) {
var _local2 = mC;
keypress = 0;
xVelOld = xVel;
yVelOld = yVel;
var _local4 = jump;
if (KeyCheck.isDown(37)) {
xVel = -scrollSpeed;
keypress = 1;
_local2.gotoAndStop("left");
}
if (KeyCheck.isDown(39)) {
xVel = scrollSpeed;
keypress = 1;
_local2.gotoAndStop("right");
}
if (KeyCheck.isDown(40)) {
yVel = scrollSpeed;
keypress = 1;
}
if (KeyCheck.isDown(38)) {
if (jump == 0) {
SetupJump();
}
keypress = 1;
}
if (keypress == 0) {
_local2.gotoAndStop(1);
xVel = xVel / 1.2;
}
yVel = yVel / 1.2;
yVel = yVel + 2;
CheckCollision(scr, scrollObjects, Coll);
}
function SetupJump() {
jump = 1;
yVel = -70;
}
function CheckCollision(scr, scrollObjects, Coll) {
var _local5 = false;
Coll.hitObjects.splice(0);
for (var _local8 in scr) {
var _local2 = scrollObjects[_local8].Tiles;
for (var _local7 in _local2) {
_local5 = Coll.CheckMoving(scrollObjects, scr, this, _local2[_local7]);
}
}
return(_local5);
}
function updatePosition() {
var _local3 = mC._x;
var _local2 = mC._y;
xPos = xPos + xVel;
yPos = yPos + yVel;
mC._x = xOrigin + xPos;
mC._y = yOrigin + yPos;
}
var xOrigin = 0;
var yOrigin = 0;
var xPos = 0;
var yPos = 0;
var s = 0;
var playerleft = 0;
var playerright = 0;
var jump = 0;
var moveplayerup = 0;
var playerdown = 0;
var playerup = 0;
var Oldplayerup = 0;
var Oldplayerdown = 0;
var Oldplayerright = 0;
var Oldplayerleft = 0;
var xVel = 0;
var yVel = 0;
var xVelOld = 0;
var yVelOld = 0;
var santaspeed = 2;
var distantPointX = 0;
var distantPointY = 0;
var newDistance = 0;
var multidirectional = 0;
var dx = 0;
var dy = 0;
var angle = 0;
}
Symbol 668 MovieClip [__Packages.Missile2] Frame 0
class Missile2
{
var root, myParent, mC, mType, bonusCount, arrayIndex;
function Missile2 (clip, xStart, yStart, rt, type, xv, yv, pp, bonusC) {
root = rt;
xOrigin = xStart;
yOrigin = yStart;
myParent = pp;
xPos = 0;
yPos = 0;
xVel = xv;
yVel = yv;
mC = clip;
mType = type;
bonusCount = bonusC;
updatePosition();
}
function missileControl(ii) {
checkForOffStage(ii);
updatePosition();
collisionDetection();
}
function mCDeath() {
var _local3 = root.Game.inGameExplosionsMc.attachMovie("explosion", "explosion" + root.Game.scoreIndex, root.Game.scoreIndex);
_local3._x = mC._x;
_local3._y = mC._y;
root.Game.scoreIndex++;
var _local4 = "bonusMc" + root.Game.bonusCountArray[bonusCount];
if (root.Game.bonusCountArray[bonusCount] == 4) {
root.sounds.extraPoints.start(0, 1);
}
root.Game.bonusCountArray[bonusCount]++;
var _local2 = root.Game.inGameScoreMc.attachMovie(_local4, "bonus" + root.Game.scoreIndex, root.Game.scoreIndex);
_local2._x = mC._x;
_local2._y = mC._y;
root.Game.scoreIndex++;
remove();
return(undefined);
}
function plotSticky(xx, yy) {
var _local2 = root.inGameBackMc.attachMovie("StickyProjectile", "sticky" + root.stickies, root.stickies);
var _local3 = (root.inGameBackMc._x - root.inGameBackMc._x) - root.inGameBackMc._x;
_local2._x = mC._x + _local3;
_local2._y = yy - root.inGameBackMc._y;
root.stickies++;
root.stickysArray.push(new Sticky(root, mC._x, mC._y, _local2));
}
function collisionDetection() {
var _local3 = 0;
while (_local3 < root.Game.badGuysArray.length) {
var _local2 = root.Game.badGuysArray[_local3];
if (myParent != _local2) {
if (_local2.collision.hitTest(mC)) {
if (_local2.used == false) {
root.Game.fireMissiles(_local2);
mCDeath();
} else {
root.Game.sizeTarget--;
root.Game.setTarget();
root.sounds.Explosion.start(0, 1);
_local2.gotoAndPlay("hit");
root.Game.badGuysArray.splice(_local3, 1);
root.Game.increaseScore(10 * root.Game.bonusCountArray[bonusCount]);
mCDeath();
}
}
}
_local3++;
}
_local3 = 0;
while (_local3 < root.Game.enemyArray.length) {
var _local4 = root.Game.enemyArray[_local3].mC;
var _local5 = _local4.collision;
if (_local5.hitTest(mC)) {
root.saucerObject.stop();
root.sounds.GotSaucer.start(0, 1);
root.Game.doSaucerEffect(_local4);
}
_local3++;
}
}
function remove() {
var _local2 = 0;
while (_local2 < root.Game.missilesArray.length) {
if (this == root.Game.missilesArray[_local2]) {
arrayIndex = _local2;
}
_local2++;
}
mC.removeMovieClip();
root.Game.missilesArray.splice(arrayIndex, 1);
}
function checkForOffStage(ii) {
if (mC._x < 0) {
remove();
}
if (mC._y < 0) {
remove();
}
if (mC._x > root.Game.movieWidth) {
remove();
}
if (mC._y > root.Game.movieHeight) {
remove();
}
}
function applyGravity() {
yVel = yVel + 1;
}
function updatePosition() {
xPos = xPos + xVel;
yPos = yPos + yVel;
var _local3 = mC._x;
var _local2 = mC._y;
mC._x = xOrigin + xPos;
mC._y = yOrigin + yPos;
var _local6 = mC._x - _local3;
var _local4 = mC._y - _local2;
var _local5 = Math.atan2(_local4, _local6);
mC._rotation = (_local5 * 180) / Math.PI;
}
var xOrigin = 0;
var yOrigin = 0;
var xPos = 0;
var yPos = 0;
var xVel = 0;
var yVel = 0;
}
Symbol 669 MovieClip [__Packages.Sticky] Frame 0
class Sticky
{
var root, mC, arrayIndex;
function Sticky (rt, xStart, yStart, clip) {
root = rt;
xOrigin = xStart;
yOrigin = yStart;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
mC = clip;
mC.myObject = this;
}
function main() {
applyGravity();
collisionDetection();
updatePosition();
}
function mCDeath() {
remove();
return(undefined);
}
function collisionDetection() {
if (yVel > 0) {
var _local10 = yVel;
var _local5 = yVel;
if (_local5 < 0) {
_local5 = (_local5 - _local5) - _local5;
}
var _local7 = false;
var _local6 = 0;
var _local9 = (root.inGameBackMc._x - root.inGameBackMc._x) - root.inGameBackMc._x;
var _local11 = xOrigin + _local9;
var _local8 = new Object();
_local8.x1 = mC._x;
_local8.y1 = mC._y;
root.inGameBackMc.localToGlobal(_local8.x1, _local8.y1);
var _local2 = 0;
while (_local2 < int(_local5)) {
var _local3 = mC._x + root.inGameBackMc._x;
_local3 = _local3 + root.scrollIndexX;
var _local4 = (mC._y = mC._y + root.inGameBackMc._y);
_local4 = _local4 + 10;
if (root.inGameBackMc.hitTest(_local3, _local4 + _local2, true)) {
_local7 = true;
_local6 = _local2;
_local2 = int(_local5);
}
_local2++;
}
if (_local7 == true) {
yVel = yVel - int(_local10);
yVel = _local6 + yVel;
}
}
}
function remove() {
var _local2 = 0;
while (_local2 < root.stickysArray.length) {
if (this == root.stickysArray[_local2]) {
arrayIndex = _local2;
}
_local2++;
}
mC.removeMovieClip();
root.stickysArray.splice(arrayIndex, 1);
}
function applyGravity() {
yVel = yVel + 16;
}
function updatePosition() {
xPos = xPos + xVel;
yPos = yPos + yVel;
var _local6 = mC._x;
var _local5 = mC._y;
var _local2 = (root.inGameBackMc._x - root.inGameBackMc._x) - root.inGameBackMc._x;
var _local4 = xOrigin + _local2;
var _local3 = yOrigin - root.inGameBackMc._y;
mC._x = _local4 + xPos;
mC._y = _local3 + yPos;
}
var xOrigin = 0;
var yOrigin = 0;
var xPos = 0;
var yPos = 0;
var xVel = 0;
var yVel = 0;
}
Symbol 670 MovieClip [__Packages.GoodGuy] Frame 0
class GoodGuy
{
var root, mC, range, arrayIndex, hits, gravity, delayToFire, gotGold, energyBarOn, xDir, target, homing, ringDrop, movingCloser, spriteType, goldMc, energyMc;
function GoodGuy (clip, rt, xStart, yStart, sp, st, grav, rg) {
root = rt;
mC = clip;
range = rg;
arrayIndex = 0;
hits = 0;
gravity = grav;
xOrigin = xStart;
yOrigin = yStart;
xOrigin = xOrigin - (root.Background.xOrigin + root.Background.xPos);
yOrigin = yOrigin - (root.Background.yOrigin + root.Background.yPos);
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
delayToFire = 30;
angle = 0.2;
gotGold = 0;
energyBarOn = 0;
degrees = 0;
radius = 255;
centerX = root.movieWidth / 2;
centerY = root.movieHeight / 2;
speed = sp;
xDir = 1;
target = undefined;
numberOfMissiles = 0;
energyStart = 100;
energy = energyStart;
homing = 0;
ringDrop = 20;
movingCloser = 0;
delayToFire = 50;
spriteType = st;
updatePosition();
}
function applyGravity() {
yVel = yVel + 1;
}
function main(index1, index2) {
if (spriteType == "man") {
fireMissile();
moveEnemy();
checkForTurret();
} else if (spriteType == "turret") {
applyGravity();
groundCollision();
fireMissile();
}
updatePosition();
}
function fireMissile() {
if (target == undefined) {
target = root.Game.findTarget();
}
var _local7 = mC._x - target.mC._x;
var _local4 = (mC._y - 60) - target.mC._y;
var _local5 = Math.atan2(_local4, _local7);
mC.gun._rotation = (_local5 * 180) / Math.PI;
delayToFire--;
if (delayToFire == 0) {
delayToFire = 100;
var _local2 = "bullet";
var _local3 = root.Game.inGameMissilesMc.attachMovie(_local2, "missile" + numberOfMissiles, numberOfMissiles);
var _local6 = (angle * 180) / Math.PI;
_local3._rotation = _local6 + 180;
numberOfMissiles++;
var _local8 = 40;
root.Game.missilesArray.push(new Missile2(_local3, mC._x, mC._y, root, _local2));
}
}
function checkForTurret() {
if (gotGold == 0) {
if (mC.m.hitTest(root.playerMc)) {
gotGold = 1;
goldMc = mC.attachMovie("bagOfGold", "g", 1);
goldMc._y = -10;
changeDirection();
}
}
}
function groundCollision() {
var _local6 = yVel;
var _local3 = yVel;
if (_local3 < 0) {
_local3 = (_local3 - _local3) - _local3;
}
var _local4 = mC._x + root.Background.mC._x;
var _local5 = mC._y + root.Background.mC._y;
var _local2 = 0;
while (_local2 < int(_local3)) {
if (root.Game.inGameBackgroundMc.hitTest(_local4, _local5 + _local2, true)) {
break;
}
_local2++;
}
yVel = yVel - int(_local6);
yVel = _local2 + yVel;
}
function moveEnemy() {
var _local5 = yVel;
var _local3 = yVel;
if (_local3 < 0) {
_local3 = (_local3 - _local3) - _local3;
}
var _local6 = mC._x + root.Background.mC._x;
var _local7 = mC._y + root.Background.mC._y;
var _local2 = 0;
while (_local2 < int(_local3)) {
if (root.Game.inGameBackgroundMc.hitTest(_local6, _local7 + _local2, true)) {
break;
}
_local2++;
}
yVel = yVel - int(_local5);
yVel = _local2 + yVel;
xVel = xDir * speed;
updatePosition();
_local6 = mC._x + root.Background.mC._x;
_local7 = mC._y + root.Background.mC._y;
if (root.Game.inGameBackgroundMc.hitTest(_local6, _local7 + _local2, true)) {
var _local4 = 0;
_local2 = 0;
while (_local2 < 10) {
yPos--;
mC._x = xOrigin + xPos;
mC._y = yOrigin + yPos;
if (root.Game.inGameBackgroundMc.hitTest(mC._x + root.scrollIndexX, mC._y, true) == false) {
_local4 = 1;
break;
}
_local2++;
}
if (_local4 == 0) {
changeDirection();
}
}
if (xPos > 1000) {
xDir = -1;
} else if (xPos < -180) {
xDir = 1;
if (gotGold == 1) {
root.Game.grabMoney(this);
}
}
if (xVel > 0) {
mC._xscale = -100;
} else {
mC._xscale = 100;
}
}
function changeDirection() {
if (xDir < 0) {
xDir = 1;
} else {
xDir = -1;
}
}
function decreaseEnergy() {
energy = energy - 10;
if (energyBarOn == 0) {
energyBarOn = 1;
energyMc = mC.attachMovie("energyBar2", "energyBar" + root.scoreIndex, root.scoreIndex + 12000);
energyMc.enemy = this;
}
energyMc._x = 0;
energyMc._y = -35;
var _local3 = energy / 10;
energyMc.bar.bar._y = int(10 - _local3);
if (energy <= 0) {
if (gotGold == 1) {
var _local2 = root.inGameBackMc.attachMovie("goldLostAnim", "goldFound" + root.lostGold, root.lostGold);
_local2.g.g.text = "+1";
root.Game.increaseMoney();
var _local4 = (root.inGameBackMc._x - root.inGameBackMc._x) - root.inGameBackMc._x;
_local2._x = mC._x + _local4;
_local2._y = mC._y - root.inGameBackMc._y;
_local2._x + 340;
}
remove();
}
}
function remove(i, i3) {
i = 0;
while (i < root.enemyArray.length) {
if (this == root.enemyArray[i]) {
arrayIndex = i;
}
i++;
}
mC.removeMovieClip();
root.enemyArray.splice(i, 1);
}
function updatePosition() {
xPos = xPos + xVel;
yPos = yPos + yVel;
mC._x = xOrigin + xPos;
mC._y = yOrigin + yPos;
}
var xOrigin = 0;
var yOrigin = 0;
var xPos = 0;
var yPos = 0;
var xVel = 0;
var yVel = 0;
var angle = 0;
var degrees = 0;
var centerX = 0;
var centerY = 0;
var radius = 0;
var speed = 0;
var cost = 0;
var playerleft = 0;
var playerright = 0;
var gameObjectType = "";
var energyStart = 0;
var energy = 0;
var delayToFireMissile = 60;
var numberOfMissiles = 0;
}
Symbol 671 MovieClip [__Packages.Game] Frame 0
class Game
{
var root, startGame, money, energy;
function Game (m, e, rt) {
root = rt;
startGame = 0;
money = m;
energy = e;
}
function increaseMoney(increase) {
money = money + increase;
}
function decreaseMoney(decrease) {
money = money - decrease;
}
function increaseEnergy(increase) {
energy = energy - increase;
if (energy <= 0) {
energy = 0;
}
}
function decreaseEnergy(decrease) {
energy = energy - decrease;
if (energy <= 0) {
startGame = 0;
root._parent.gotoAndStop("gameOver");
}
}
}
Symbol 672 MovieClip [__Packages.FlowPlayAPI] Frame 0
class FlowPlayAPI
{
static var interval, score_path, score_var, level_path, level_var;
function FlowPlayAPI () {
}
static function StartReporting() {
if (interval) {
SendError("StartReporting() - Reporting is already on!");
} else {
interval = setInterval(SendUpdate, 1000);
}
}
static function StopReporting() {
if (interval) {
clearInterval(interval);
interval = undefined;
} else {
SendError("StopReporting() - Reporting wasn't started!");
}
}
static function SendUpdate() {
var _local1 = GetScore();
var _local2 = GetLevel();
flash.external.ExternalInterface.call("fpBroadcastScore", _local1);
flash.external.ExternalInterface.call("fpBroadcastLevel", _local2);
}
static function GetScore() {
if (score_var and score_path) {
return(score_path[score_var]);
}
if (score) {
return(score);
}
return(0);
}
static function GetLevel() {
if (level_var and level_path) {
return(level_path[level_var]);
}
if (level) {
return(level);
}
return(0);
}
static function SetScore(s) {
if (score_var) {
SendError("You cannot set scores once you have used the SetScoreVariable() function.");
} else {
score = s;
}
}
static function SetLevel(l) {
if (score_var) {
SendError("You cannot set levels once you have used the SetLevelVariable() function.");
} else {
level = l;
}
}
static function UpdateScore(s) {
if (score_var) {
SendError("You cannot update scores once you have used the SetScoreVariable() function.");
} else {
score = score + s;
}
}
static function UpdateLevel(l) {
if (score_var) {
SendError("You cannot update levels once you have used the SetLevelVariable() function.");
} else {
level = level + l;
}
}
static function SetScoreVariable(v) {
var _local1 = ValidatePath(v);
if (_local1) {
score_var = _local1.v;
score_path = _local1.p;
}
}
static function SetLevelVariable(v) {
var _local1 = ValidatePath(v);
if (_local1) {
level_var = _local1.v;
level_path = _local1.p;
}
}
static function ValidatePath(p) {
var _local3 = p.split(".");
if ((_local3[0] != "_root") and (_local3[0] != "_global")) {
SendError((("Invalid variable. Please define the full variable path, ie _root." + p) + " or _global.") + p);
return(null);
}
var _local4 = new Object();
_local4.v = _local3.pop();
var _local6 = _local3.unshift();
if (_local6 == "_global") {
_local4.p = ReadPath(_global, _local3);
} else {
_local4.p = ReadPath(_root, _local3);
}
if (_local4.p[_local4.v] == undefined) {
SendError(p + " does not exist!");
} else {
return(_local4);
}
}
static function ReadPath(object, path) {
var _local1 = path.shift();
if (path.length < 1) {
return(object[_local1]);
}
return(ReadPath(object[_local1], path));
}
static function SendError(err) {
}
static function ShowScores() {
}
static var level = 0;
static var score = 0;
static var loop = 0;
}
Symbol 673 MovieClip [__Packages.GamePresentation] Frame 0
class GamePresentation
{
var rt, mC, splashScreenMc, optionsMc, elementMc, btnType, myObject;
function GamePresentation (rt2) {
rt = rt2;
mC = rt.Game.presentationMc;
}
function setupSplashScreen(elementsPositions) {
splashScreenMc = mC.attachMovie("SplashScreen", "splashscreenmc", 1);
var _local2 = splashScreenMc.attachMovie("splashInfo", "screens", 100);
_local2._x = 355;
_local2._y = 200;
setupPresentationElements();
}
function setupPresentationElements() {
optionsMc = splashScreenMc.createEmptyMovieClip("options", 1);
var _local4 = optionsMc.attachMovie("SplashScreenButtons", "splashscreenbtns", 1);
_local4._x = 105;
_local4._y = 130;
var _local2 = 0;
while (_local2 < rt.splashScreenElements.length) {
var _local3 = rt.splashScreenElements;
elementMc = _local4.buttons[_local3[_local2]];
elementMc.btn.btnType = _local3[_local2];
elementMc.btn.splashScreenMc = splashScreenMc;
elementMc.btn.myObject = this;
elementMc.btn.onRelease = clickRightSplashSceenBtn;
elementMc.btn.onRollOver = rollOverSplashSceenBtn;
elementMc.btn.onRollOut = rollOutSplashSceenBtn;
_local2++;
}
}
function setupPresentationElements2() {
optionsMc = splashScreenMc.createEmptyMovieClip("options", 1);
var _local4 = optionsMc.attachMovie("SplashScreenButtons", "splashscreenbtns", 1);
_local4.buttons.gotoAndStop(105);
_local4._x = 105;
_local4._y = 130;
var _local2 = 0;
while (_local2 < rt.splashScreenElements.length) {
var _local3 = rt.splashScreenElements;
elementMc = _local4.buttons[_local3[_local2]];
elementMc.btn.btnType = _local3[_local2];
elementMc.btn.splashScreenMc = splashScreenMc;
elementMc.btn.myObject = this;
elementMc.btn.onRelease = clickRightSplashSceenBtn;
elementMc.btn.onRollOver = rollOverSplashSceenBtn;
elementMc.btn.onRollOut = rollOutSplashSceenBtn;
_local2++;
}
}
function clickRightSplashSceenBtn() {
if (btnType == "playInfo") {
myObject.rt.Game.gameState = "setup";
} else if (btnType == "instructionsInfo") {
splashScreenMc.screens.gotoAndStop("showinstructions");
splashScreenMc.options.removeMovieClip();
} else if (btnType == "controlsInfo") {
splashScreenMc.screens.gotoAndStop("showcontrols");
splashScreenMc.options.removeMovieClip();
} else if (btnType == "highscoresInfo") {
getURL ("http://www.ourworld.com/v11/tracking?source=game&id=fglspacemonkey", "_blank");
}
}
function rollOverSplashSceenBtn() {
}
function rollOutSplashSceenBtn() {
if (btnType == "playBtnAnim") {
} else if (btnType == "instructionsBtnAnim") {
} else if (btnType == "controlsBtnAnim") {
} else if (btnType == "highscoresBtnAnim") {
}
}
function RandomNumber(x, y) {
return(Math.round(Math.random() * (y - x)) + x);
}
function getArcVelocity(gravity, speed, xStart, yStart, xEnd, yEnd) {
var _local1 = new Object();
var _local3 = xEnd - xStart;
var _local4 = yEnd - yStart;
var _local6 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
var _local2 = Math.ceil(_local6 / speed);
_local1.gravity = gravity;
_local1.steps = _local2;
_local1.xStep = _local3 / _local2;
_local1.yStep = _local4 / _local2;
if (gravity > 0) {
_local1.yStep = _local1.yStep - ((_local2 * gravity) / 2);
}
return(_local1);
}
function localToGlobalXY(mc1) {
var _local3 = new Object();
_local3.newX = 0;
_local3.newY = 0;
var _local2 = mc1;
while (_local2 != _root) {
var _local6 = _local3.newX * (_local2._xscale / 100);
var _local5 = _local3.newY * (_local2._yscale / 100);
var _local4 = _local2._rotation * (Math.PI/180);
_local3.newX = (_local6 * Math.cos(_local4)) - (_local5 * Math.sin(_local4));
_local3.newY = (_local6 * Math.sin(_local4)) + (_local5 * Math.cos(_local4));
_local3.newX = _local3.newX + _local2._x;
_local3.newY = _local3.newY + _local2._y;
_local2 = _local2._parent;
}
return(_local3);
}
function radian(degree) {
return((Math.PI/180) * degree);
}
function addThrust(rot, speed) {
var _local2 = new Object();
_local2.xVel = Math.cos(radian(rot)) * speed;
_local2.yVel = Math.sin(radian(rot)) * speed;
return(_local2);
}
}
Symbol 674 MovieClip [__Packages.GameGame] Frame 0
class GameGame
{
var mC, rt, numBalls, movieWidth, movieHeight, blockSize, levelWidthBlocks, levelHeightBlocks, levelWidth, levelHeight, gameState, lostGold, numberOfMissiles, inGameMc, presentationMc, inGameActionMc, inGameStatsMc, inGameContainerMc, ballMc, inGameMsgsMc, playerMc, inGameBackgroundParallaxMc, inGameBackgroundMc, inGameEnemyMc, inGameMissilesMc, inGameExplosionsMc, inGameScoreMc, inGameObjectsMc, missilesArray, enemyArray, goodGuysArray, targetArray, numberOfDropped, rightPanelGameObjects, gameObjects, backgroundSquaresArray, currentPickedUp, score, oxygenLevel, sizeTarget, bestScore, starAnimDelay, lives, meterLevel, meterLevelSpeed, gameStartDelay, meterLevelDir, scoreIndex, xMidway, yMidway, starTrails, cannonManFlying, ballChainArray, badGuysArray, bonusCountArray, spring, friction, gravity, springLength, ballCount, saucerChance, saucerDelay, left, right, top, bottom, levelNumber, scaleSpeed, balloonPlotted, extraPointsSound, secDisplay, minDisplay, StartTimer, clockDelay, minutes, sec, fulltime, bottomEdge, rightEdge, pauseSwitch, asteroidsDestroyed, distanceTraveledSpace, pauseMc, powerMeter, msgMc, endScreenMc, currentTimeBonus, timeBonus;
function GameGame (mc, rt2, sw, sh, levelW, levelH, startLives) {
mC = mc;
rt = rt2;
numBalls = 15;
movieWidth = sw;
movieHeight = sh;
blockSize = 32;
levelWidthBlocks = levelW;
levelHeightBlocks = levelH;
levelWidth = levelWidthBlocks * blockSize;
levelHeight = levelHeightBlocks * blockSize;
gameState = "loading";
lostGold = 0;
numberOfMissiles = 0;
inGameMc = mC.createEmptyMovieClip("inGameMc", 0);
presentationMc = mC.createEmptyMovieClip("presentationMc", 1);
inGameActionMc = inGameMc.createEmptyMovieClip("inGameActionMc", 0);
inGameStatsMc = inGameMc.createEmptyMovieClip("inGameStatsMc", 1);
inGameContainerMc = inGameActionMc.createEmptyMovieClip("inGameBackgroundMc", 9);
ballMc = inGameActionMc.createEmptyMovieClip("cannonman", 10);
inGameMsgsMc = inGameActionMc.createEmptyMovieClip("cannonman", 11);
playerMc = inGameContainerMc.createEmptyMovieClip("player", 6);
inGameBackgroundParallaxMc = inGameActionMc.createEmptyMovieClip("inGameBackgroundParallaxMc2", 0);
inGameBackgroundMc = inGameContainerMc.createEmptyMovieClip("inGameBackgroundMc", 0);
inGameEnemyMc = inGameContainerMc.createEmptyMovieClip("inGameEnemysMc", 1);
inGameMissilesMc = inGameContainerMc.createEmptyMovieClip("inGameMissilesMc", 2);
inGameExplosionsMc = inGameContainerMc.createEmptyMovieClip("inGameExplosionsMc", 3);
inGameScoreMc = inGameContainerMc.createEmptyMovieClip("inGameScoresMc", 4);
inGameObjectsMc = inGameContainerMc.createEmptyMovieClip("inGameObjectsMc", 5);
missilesArray = new Array();
enemyArray = new Array();
goodGuysArray = new Array();
targetArray = new Array();
numberOfDropped = 0;
rightPanelGameObjects = new Array();
gameObjects = new Array();
backgroundSquaresArray = new Array();
currentPickedUp = undefined;
score = 0;
oxygenLevel = 100;
sizeTarget = 0;
bestScore = 0;
starAnimDelay = 4;
lives = startLives;
meterLevel = 0;
meterLevelSpeed = 20;
gameStartDelay = 20;
meterLevelDir = meterLevelSpeed;
scoreIndex = 0;
xMidway = 0;
yMidway = 0;
starTrails = 0;
cannonManFlying = 0;
ballChainArray = new Array();
badGuysArray = new Array();
bonusCountArray = new Array();
spring = 0.1;
friction = 0.8;
gravity = 5;
springLength = 10;
ballCount = 3;
saucerChance = 50;
saucerDelay = -1;
saucerDelay = rt.Useful1.RandomNumber(50, 400);
left = -20;
right = movieWidth - 20;
top = 0;
bottom = movieHeight;
levelNumber = 1;
scaleSpeed = 8;
balloonPlotted = false;
extraPointsSound = false;
secDisplay = "00";
minDisplay = "00";
StartTimer = 1;
clockDelay = 10;
minutes = StartTimer;
sec = 0;
fulltime = 0;
bottomEdge = movieHeight;
rightEdge = movieWidth;
pauseSwitch = false;
asteroidsDestroyed = 0;
distanceTraveledSpace = 0;
setupPanel();
}
function setupPanel() {
var _local3 = inGameStatsMc.attachMovie("weapons", "ingamestatsmc", 1);
_local3._y = movieHeight - (blockSize * 2);
var _local2 = _local3.wg;
_local2 = _local2.stats;
_local2.musicBtn.myObject = this;
_local2.musicBtn.myMc = _local2;
_local2.quitBtn.myObject = this;
if (rt.soundSwitch == "off") {
_local2.musicBtn._parent.music.gotoAndStop(2);
}
_local2.musicBtn.onRelease = function () {
if (this.myMc.music._currentframe == 1) {
this.myObject.rt.soundFade = "out";
this.myMc.music.gotoAndStop("off");
this.myObject.rt.musicPlaying = "off";
} else {
this.myObject.rt.soundFade = "in";
this.myMc.music.gotoAndStop("on");
this.myObject.rt.musicPlaying = "on";
}
};
_local2.quitBtn.onRelease = function () {
if (this.myObject.rt.Game.pauseSwitch == false) {
this.myObject.rt.obj.vx = 0;
this.myObject.rt.obj.vy = 0;
this.myObject.rt.Game.balloonPlotted = false;
this.myObject.rt.obj.clip.removeMovieClip();
this.myObject.rt.Game.msgMc.removeMovieClip();
this.myObject.rt.Game.gameState = "game_over_restart";
}
};
}
function turnMusicOff() {
var _local2 = inGameStatsMc.ingamestatsmc;
_local2 = _local2.wg;
_local2 = _local2.stats;
_local2.music.gotoAndStop(2);
}
function turnMusicOn() {
var _local2 = inGameStatsMc.ingamestatsmc;
_local2 = _local2.wg;
_local2 = _local2.stats;
_local2.music.gotoAndStop(1);
}
function pauseOn() {
pauseSwitch = true;
gameState = "pause";
pauseMc = inGameMc.attachMovie("pauseMc", "pauseMc", 3);
}
function pauseOff() {
pauseSwitch = false;
gameState = "play";
pauseMc.removeMovieClip();
}
function deleteMeter() {
powerMeter.removeMovieClip();
}
function displayMeter() {
rt.mousePointer.attachMovie("shotStrengthMeter", "meter", 2);
}
function setupMeter() {
powerMeter = playerMc.attachMovie("shotStrengthMeter", "meter", 2);
}
function resetMcs() {
inGameEnemyMc = inGameContainerMc.createEmptyMovieClip("inGameEnemysMc", 1);
inGameMissilesMc = inGameContainerMc.createEmptyMovieClip("inGameMissilesMc", 2);
inGameExplosionsMc = inGameContainerMc.createEmptyMovieClip("inGameExplosionsMc", 3);
inGameScoreMc = inGameContainerMc.createEmptyMovieClip("inGameScoresMc", 4);
inGameObjectsMc = inGameContainerMc.createEmptyMovieClip("inGameObjectsMc", 5);
}
function gameOver(gameOverType) {
rt.sendStat("asteroids_destroyed", asteroidsDestroyed, "max");
rt.sendStat("distance_traveled_in_space", distanceTraveledSpace, "max");
rt.stopReporting();
rt.Player.gun.monkey.frames.gotoAndStop("stand");
rt.saucerObject.stop();
extraPointsSound = false;
if (gameOverType == "out_of_time") {
gameState = "game_over";
msgMc = inGameMsgsMc.attachMovie("gameOverMsgAnim", "gameover", 1);
msgMc._x = movieWidth / 2;
msgMc._x = msgMc._x - 12;
msgMc._y = movieHeight / 2;
msgMc._y = msgMc._y - 4;
rt.sounds.GameOverRobot.start(0, 1);
} else if (levelNumber == 15) {
gameState = "game_over";
endScreenMc = presentationMc.attachMovie("endScreen", "gameComplete", 1);
endScreenMc._x = (movieWidth / 2) - 17;
endScreenMc._y = movieHeight / 2;
endScreenMc.balloon.balloon.furries._alpha = 100;
} else {
gameState = "level_complete";
msgMc = inGameMsgsMc.attachMovie("levelCompleteMsgAnim", "levelComplete", 1);
msgMc._x = movieWidth / 2;
msgMc._y = (movieHeight / 2) - 60;
currentTimeBonus = 0;
timeBonus = minutes * 60;
timeBonus = timeBonus + sec;
var _local2 = 20;
var _local3 = 30;
var _local4 = 46.1538461538462;
if (timeBonus < _local2) {
msgMc.howWellDone = 1;
}
if (timeBonus < _local3) {
msgMc.howWellDone = 2;
} else {
msgMc.howWellDone = 3;
}
}
}
function setupEnemy(mCName) {
var _local2 = inGameEnemyMc.attachMovie(mCName, "ee" + numberOfDropped, numberOfDropped);
enemyArray.push(new Enemy1(_local2, rt, mCName));
numberOfDropped++;
}
function setupEnemies() {
enemyArray.splice(0);
var _local3 = rt.enemies[levelNumber - 1];
var _local2 = 0;
while (_local2 < _local3.length) {
setupEnemy(_local3[_local2]);
_local2++;
}
}
function removeGerms() {
var _local2 = 0;
while (_local2 < badGuysArray.length) {
var _local3 = badGuysArray[_local2];
_local3.swapDepths(1);
_local3.removeMovieClip();
_local2++;
}
}
function fireGun(xStart, yStart, vx, vy, myParent) {
var _local2 = "bullet";
var _local3 = inGameMissilesMc.attachMovie(_local2, "missile" + numberOfMissiles, numberOfMissiles);
numberOfMissiles++;
missilesArray.push(new Missile2(_local3, xStart, yStart, rt, _local2, vx, vy, myParent, bonusCountArray.length - 1));
missilesArray[missilesArray.length - 1].updatePosition();
}
function setupGerms() {
removeGerms();
badGuysArray.splice(0);
inGameEnemyMc = inGameContainerMc.createEmptyMovieClip("inGameEnemysMc", 1);
inGameMissilesMc = inGameContainerMc.createEmptyMovieClip("inGameMissilesMc", 2);
inGameExplosionsMc = inGameContainerMc.createEmptyMovieClip("inGameExplosionsMc", 3);
inGameScoreMc = inGameContainerMc.createEmptyMovieClip("inGameScoresMc", 4);
inGameObjectsMc = inGameContainerMc.createEmptyMovieClip("inGameObjectsMc", 5);
var _local5 = 0;
while (_local5 < rt.numberOfObstacles[levelNumber]) {
var _local2 = inGameEnemyMc.attachMovie("badBall", "badBall" + _local5, _local5 + 1000);
_local2._x = (Math.random() * movieWidth) - _local2._width;
_local2._y = (Math.random() * movieHeight) - _local2._height;
_local2.vx = rt.Useful1.RandomNumber(0, 5);
_local2.vy = rt.Useful1.RandomNumber(0, 5);
_local2.used = false;
_local2._xscale = (_local2._yscale = 200);
_local2.mass = 10;
_local2.done = 0;
var _local4 = _local2.bubble.surface;
var _local3 = 0;
while (_local3 < 16) {
_local4["s" + (_local3 + 1)].done = 0;
_local4["s" + (_local3 + 1)].gotoAndStop(1);
_local3++;
}
badGuysArray.push(_local2);
_local5++;
}
var _local6 = rt.numberOfObstacles[levelNumber];
_local5 = 0;
while (_local5 < rt.numberOfObstacles2[levelNumber]) {
var _local2 = inGameEnemyMc.attachMovie("badBall", "badBall" + (_local5 + _local6), (_local5 + _local6) + 1000);
_local2._x = (Math.random() * movieWidth) - _local2._width;
_local2._y = (Math.random() * movieHeight) - _local2._height;
_local2.vx = rt.Useful1.RandomNumber(0, 5);
_local2.vy = rt.Useful1.RandomNumber(0, 5);
_local2.used = false;
_local2._xscale = (_local2._yscale = 200);
_local2.mass = 10;
_local2.done = 0;
_local2.unstableDelay = 100;
_local2.bubble.gotoAndStop(2);
var _local4 = _local2.bubble.surface;
var _local3 = 0;
while (_local3 < 16) {
_local4["s" + (_local3 + 1)].done = 0;
_local4["s" + (_local3 + 1)].gotoAndStop(1);
_local3++;
}
badGuysArray.push(_local2);
_local5++;
}
_local6 = rt.numberOfObstacles[levelNumber] + rt.numberOfObstacles2[levelNumber];
_local5 = 0;
while (_local5 < rt.numberOfSuns[levelNumber]) {
var _local2 = inGameEnemyMc.attachMovie("badBall", "sun" + (_local5 + _local6), (_local5 + _local6) + 1000);
_local2._x = (Math.random() * movieWidth) - _local2._width;
_local2._y = (Math.random() * movieHeight) - _local2._height;
_local2.vx = rt.Useful1.RandomNumber(0, 5);
_local2.vy = rt.Useful1.RandomNumber(0, 5);
_local2.used = false;
_local2._xscale = (_local2._yscale = 200);
_local2.mass = rt.sunMass;
_local2.done = 0;
_local2.bubble.gotoAndStop(rt.sunFrame);
badGuysArray.push(_local2);
_local5++;
}
_local5 = 0;
while (_local5 < rt.numberOfAsteroids[levelNumber]) {
var _local2 = inGameEnemyMc.attachMovie("badBall", "asteroid" + (_local5 + 100), (_local5 + 100) + 1000);
_local2._x = (Math.random() * movieWidth) - _local2._width;
_local2._y = (Math.random() * movieHeight) - _local2._height;
_local2.vx = rt.Useful1.RandomNumber(0, 5);
_local2.vy = rt.Useful1.RandomNumber(0, 5);
_local2.used = false;
_local2._xscale = (_local2._yscale = 200);
_local2.mass = 15;
_local2.done = 0;
_local2.bubble.gotoAndStop(rt.asteroidFrame);
badGuysArray.push(_local2);
_local2.myIndex = badGuysArray.length - 1;
_local5++;
}
rt.Player.xOrigin = badGuysArray[0]._x;
rt.Player.yOrigin = badGuysArray[0]._y;
rt.Player.updatePosition();
}
function checkWalls(ball) {
if (ball._x < (left + (ball._width / 2))) {
ball._x = left + (ball._width / 2);
ball.vx = ball.vx * -1;
} else if (ball._x > (right - (ball._width / 2))) {
ball._x = right - (ball._width / 2);
ball.vx = ball.vx * -1;
}
if (ball._y < (top + (ball._height / 2))) {
ball._y = top + (ball._height / 2);
ball.vy = ball.vy * -1;
} else if (ball._y > (bottom - (ball._height / 2))) {
ball._y = bottom - (ball._height / 2);
ball.vy = ball.vy * -1;
}
}
function checkCollision(ball0, ball1) {
var _local11 = ball1._x - ball0._x;
var _local10 = ball1._y - ball0._y;
var _local24 = Math.sqrt((_local11 * _local11) + (_local10 * _local10));
var _local22 = (ball0._width / 2) - 10;
var _local21 = (ball1._width / 2) - 10;
if (_local24 < (_local22 + _local21)) {
if ((ball0.bubble._currentframe == rt.asteroidFrame) or (ball1.bubble._currentframe == rt.asteroidFrame)) {
if (ball0.bubble._currentframe != rt.asteroidFrame) {
var _local5 = ball0.bubble.surface;
_local5.gotoAndStop(1);
if (ball0.done == 1) {
sizeTarget++;
}
ball0.done = 0;
var _local2 = 0;
while (_local2 < 16) {
_local5["s" + (_local2 + 1)].done = 0;
_local5["s" + (_local2 + 1)].gotoAndStop(1);
_local2++;
}
if (ball0.bubble.planetA._currentframe != 1) {
ball0.bubble.planetA.play();
}
} else {
var _local5 = ball1.bubble.surface;
_local5.gotoAndStop(1);
if (ball1.done == 1) {
sizeTarget++;
}
ball1.done = 0;
var _local2 = 0;
while (_local2 < 16) {
_local5["s" + (_local2 + 1)].done = 0;
_local5["s" + (_local2 + 1)].gotoAndStop(1);
_local2++;
}
if (ball1.bubble.planetA._currentframe != 1) {
ball1.bubble.planetA.play();
}
}
} else if ((ball0.bubble._currentframe == rt.sunFrame) and (ball1.bubble._currentframe == rt.sunFrame)) {
if ((ball0.mass != 100) or (ball1.mass != 100)) {
ball0.bubble.sun.play();
ball1.bubble.sun.play();
ball0.mass = 100;
ball1.mass = 100;
}
}
var _local17 = Math.atan2(_local10, _local11);
var _local8 = Math.sin(_local17);
var _local7 = Math.cos(_local17);
var _local13 = {x:0, y:0};
var _local12 = rotate(_local11, _local10, _local8, _local7, true);
var _local6 = rotate(ball0.vx, ball0.vy, _local8, _local7, true);
var _local9 = rotate(ball1.vx, ball1.vy, _local8, _local7, true);
var _local23 = _local6.x - _local9.x;
_local6.x = (((ball0.mass - ball1.mass) * _local6.x) + ((2 * ball1.mass) * _local9.x)) / (ball0.mass + ball1.mass);
_local9.x = _local23 + _local6.x;
var _local19 = Math.abs(_local6.x) + Math.abs(_local9.x);
var _local20 = (_local22 + _local21) - Math.abs(_local13.x - _local12.x);
_local13.x = _local13.x + ((_local6.x / _local19) * _local20);
_local12.x = _local12.x + ((_local9.x / _local19) * _local20);
var _local14 = rotate(_local13.x, _local13.y, _local8, _local7, false);
var _local15 = rotate(_local12.x, _local12.y, _local8, _local7, false);
ball1._x = ball0._x + _local15.x;
ball1._y = ball0._y + _local15.y;
ball0._x = ball0._x + _local14.x;
ball0._y = ball0._y + _local14.y;
var _local16 = rotate(_local6.x, _local6.y, _local8, _local7, false);
var _local18 = rotate(_local9.x, _local9.y, _local8, _local7, false);
ball0.vx = _local16.x;
ball0.vy = _local16.y;
ball1.vx = _local18.x;
ball1.vy = _local18.y;
}
}
function rotate(x, y, sine, cosine, reverse) {
var _local1 = new Object();
if (reverse) {
_local1.x = (x * cosine) + (y * sine);
_local1.y = (y * cosine) - (x * sine);
} else {
_local1.x = (x * cosine) - (y * sine);
_local1.y = (y * cosine) + (x * sine);
}
return(_local1);
}
function checkForGameOver() {
if (sizeTarget == 0) {
gameOver("level_complete");
} else if (oxygenLevel == 0) {
gameOver("out_of_time");
}
}
function fireMissiles(ball) {
ball.used = true;
ball.play();
bonusCountArray.push(1);
fireGun(ball._x, ball._y, 10, 0, ball);
fireGun(ball._x, ball._y, -10, 0, ball);
fireGun(ball._x, ball._y, 0, 10, ball);
fireGun(ball._x, ball._y, 0, -10, ball);
if (ball._xscale != 40) {
ball._xscale = ball._xscale - 40;
ball._yscale = ball._xscale;
}
rt.mouseButton = false;
rt.sounds.fire.start(0, 1);
}
function mainLoop() {
if (gameState == "play") {
doClock();
checkForGameOver();
var _local5 = 0;
while (_local5 < enemyArray.length) {
enemyArray[_local5].main();
_local5++;
}
_local5 = 0;
while (_local5 < badGuysArray.length) {
var _local4 = badGuysArray[_local5];
if (_local4.bubble._currentframe == 2) {
if (_local4.done != 0) {
_local4.unstableDelay--;
if (_local4.unstableDelay == 0) {
_local4.unstableDelay = 100;
var _local6 = rt.Useful1.RandomNumber(1, 16);
if (_local4.bubble.surface["s" + _local6]._currentframe != 1) {
_local4.bubble.surface["s" + _local6].gotoAndPlay(1);
_local4.bubble.surface["s" + _local6].done = 0;
_local4.bubble.surface.gotoAndStop(1);
if (_local4.done == 1) {
sizeTarget++;
_local4.bubble.planetA.gotoAndStop(1);
}
_local4.done = 0;
}
}
}
}
_local5++;
}
_local5 = 0;
while (_local5 < badGuysArray.length) {
var _local4 = badGuysArray[_local5];
_local4._x = _local4._x + _local4.vx;
_local4._y = _local4._y + _local4.vy;
checkWalls(_local4);
_local5++;
}
_local5 = 0;
while (_local5 < badGuysArray.length) {
var _local7 = badGuysArray[_local5];
if (_local7.asteroid != "done") {
var _local2 = _local5 + 1;
while (_local2 < badGuysArray.length) {
var _local3 = badGuysArray[_local2];
if (_local3.asteroid != "done") {
checkCollision(_local7, _local3);
}
_local2++;
}
}
_local5++;
}
rt.Player.mainLoop();
doStarTrail();
}
}
function checkBallCollision(ball1, ball2, mCWidth) {
var _local2 = rt.Useful1.getDistance(ball1, ball2);
_local2 = _local2 - (ball2._width / 2);
_local2 = _local2 - mCWidth;
if (_local2 < 0) {
return(true);
}
return(false);
}
function explode(ind) {
badGuysArray[ind].gotoAndStop("myColour");
}
function doStarTrail() {
if (rt.Player.playerState == "flying") {
starAnimDelay--;
if (starAnimDelay == 0) {
starAnimDelay = 4;
msgMc = inGameExplosionsMc.attachMovie("starAnim", "stars" + starTrails, starTrails);
msgMc._x = rt.Player.mC._x;
msgMc._y = rt.Player.mC._y;
msgMc._x = msgMc._x - rt.Player.vectorData.xPos;
msgMc._y = msgMc._y - rt.Player.vectorData.yPos;
msgMc._xscale = (msgMc._yscale = 20);
starTrails++;
}
}
}
function decreaseScore() {
}
function increaseScore(increase) {
score = int(score + increase);
if (score > 0) {
setScore();
}
}
function setLives() {
var _local2 = inGameStatsMc.ingamestatsmc;
_local2 = _local2.wg;
_local2 = _local2.stats;
_local2.lives.text = lives;
}
function decreaseOxygen(d) {
oxygenLevel = oxygenLevel - d;
if (oxygenLevel < 0) {
oxygenLevel = 0;
}
setOxygen();
}
function increaseOxygen(d) {
oxygenLevel = oxygenLevel + d;
if (oxygenLevel > 100) {
oxygenLevel = 100;
}
setOxygen();
}
function setOxygen() {
var _local2 = inGameStatsMc.ingamestatsmc;
_local2 = _local2.wg;
_local2 = _local2.stats;
_local2.sizeTarget.text = oxygenLevel;
}
function setLevel() {
var _local2 = inGameStatsMc.ingamestatsmc;
_local2 = _local2.wg;
_local2 = _local2.stats;
_local2.level.text = levelNumber;
}
function setScore() {
var _local2 = inGameStatsMc.ingamestatsmc;
_local2 = _local2.wg;
_local2 = _local2.stats;
if (score < 10) {
_local2.score.text = "0000" + score;
} else if (score < 100) {
_local2.score.text = "000" + score;
} else if (score < 1000) {
_local2.score.text = "00" + score;
} else if (score < 10000) {
_local2.score.text = "0" + score;
} else {
_local2.score.text = score;
}
}
function setBest() {
var _local2 = inGameStatsMc.ingamestatsmc;
_local2 = _local2.wg;
_local2 = _local2.stats;
if (bestScore < 10) {
_local2.bestScore.text = "0000" + bestScore;
} else if (bestScore < 100) {
_local2.bestScore.text = "000" + bestScore;
} else if (bestScore < 1000) {
_local2.bestScore.text = "00" + bestScore;
} else if (bestScore < 10000) {
_local2.bestScore.text = "0" + bestScore;
} else {
_local2.bestScore.text = bestScore;
}
}
function doClock() {
clockDelay--;
if (clockDelay == 0) {
clockDelay = 20;
countDown();
}
}
function countDown() {
sec--;
if (sec < 0) {
minutes--;
sec = 59;
if (minutes < 0) {
minutes = 0;
sec = 0;
gameOver("out_of_time");
}
}
displayTime();
}
function displayTime() {
if (sec < 10) {
secDisplay = "0" + sec;
} else {
secDisplay = String(sec);
}
if (minutes < 10) {
minDisplay = "0" + minutes;
} else {
minDisplay = String(minutes);
}
var _local2 = inGameStatsMc.ingamestatsmc;
_local2 = _local2.wg;
_local2 = _local2.stats;
_local2.time.text = ((minDisplay + ":") + secDisplay) + "s";
}
var myColour = 7;
}
Symbol 675 MovieClip [__Packages.Enemy1] Frame 0
class Enemy1
{
var root, currentRing, arrayIndex, hits, ringRadius, delayToFire, gotGold, energyBarOn, enemyName, xDir, mC, homing, ringDrop, spriteData, movingCloser, delayTillMove, planetIndex, energyMc;
function Enemy1 (clip, rt, eN) {
root = rt;
currentRing = 1;
arrayIndex = 0;
hits = 0;
ringRadius = 255;
xOrigin = 0;
yOrigin = 0;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
delayToFire = 100;
angle = 0.2;
gotGold = 0;
energyBarOn = 0;
degrees = 0;
radius = 255;
enemyName = eN;
centerX = root.movieWidth / 2;
centerY = root.movieHeight / 2;
xDir = 1;
mC = clip;
numberOfMissiles = 0;
energyStart = 100;
energy = energyStart;
homing = 0;
ringDrop = 20;
spriteData = new Object();
movingCloser = 0;
delayToFire = 50;
delayTillMove = 20;
if (enemyName == "flyingsaucer") {
resetPosition();
} else {
findPlanetToStart();
}
}
function findPlanetToStart() {
var _local2 = 0;
while (_local2 < root.Game.badGuysArray.length) {
var _local3 = root.Game.badGuysArray[_local2];
if (_local3.mass != root.sunMass) {
if (root.Player.planetIndex != _local2) {
planetIndex = _local2;
_local2 = root.Game.badGuysArray.length;
}
}
_local2++;
}
updatePosition();
}
function findNewPlanet() {
var _local4 = false;
var _local2 = 0;
while (_local2 < root.Game.badGuysArray.length) {
var _local3 = root.Game.badGuysArray[_local2];
if (_local3.mass != root.sunMass) {
if (root.Player.planetIndex != _local2) {
if (planetIndex != _local2) {
planetIndex = _local2;
_local2 = root.Game.badGuysArray.length;
_local4 = true;
}
}
}
_local2++;
}
return(_local4);
}
function resetPosition() {
}
function applyGravity() {
yVel = yVel + 1;
}
function main(index1, index2) {
moveEnemy();
updatePosition();
}
function fireMissile() {
delayToFire--;
if (delayToFire == 0) {
delayToFire = 100;
var _local3 = "StickyProjectile";
var _local4 = root.inGameMissilesMc.attachMovie(_local3, "missile" + root.Game.numberOfMissiles, root.Game.numberOfMissiles);
var _local5 = (root.Player.angle * 180) / Math.PI;
_local4._rotation = _local5 + 180;
root.Game.numberOfMissiles++;
var _local2 = root.Useful.getArcVelocity(1, 10, mC._x, mC._y, root.playerMc._x, root.playerMc._y);
root.missilesArray.push(new Missile2(_local4, root.playerMc._x + ((-_local2.xStep) * root.missileDistFromGun), root.playerMc._y + ((-_local2.yStep) * root.missileDistFromGun), root, _local3));
root.missilesArray[root.missilesArray.length - 1].xVel = -_local2.xStep;
root.missilesArray[root.missilesArray.length - 1].yVel = -_local2.yStep;
}
}
function moveEnemy() {
if (enemyName == "alien") {
var _local2 = true;
delayTillMove--;
if (delayTillMove == 0) {
_local2 = findNewPlanet();
delayTillMove = 100;
}
if (_local2 == false) {
remove();
} else {
xOrigin = root.Game.badGuysArray[planetIndex]._x;
yOrigin = root.Game.badGuysArray[planetIndex]._y;
spriteData = root.Useful1.pointTowards(mC._x, mC._y, root.Player.mC._x, root.Player.mC._y);
if (mC._rotation > spriteData.spriteRotation) {
mC._rotation = mC._rotation - 2;
} else {
mC._rotation = mC._rotation + 2;
}
}
}
}
function changeDirection() {
if (xDir < 0) {
xDir = 1;
} else {
xDir = -1;
}
}
function decreaseEnergy() {
energy = energy - 10;
if (energyBarOn == 0) {
energyBarOn = 1;
energyMc = mC.attachMovie("energyBar2", "energyBar" + root.scoreIndex, root.scoreIndex + 12000);
energyMc.enemy = this;
}
energyMc._x = 0;
energyMc._y = -35;
var _local3 = energy / 10;
energyMc.bar.bar._y = int(10 - _local3);
if (energy <= 0) {
if (gotGold == 1) {
var _local2 = root.inGameBackMc.attachMovie("goldLostAnim", "goldFound" + root.lostGold, root.lostGold);
_local2.g.g.text = "+1";
root.Game.increaseMoney();
var _local4 = (root.inGameBackMc._x - root.inGameBackMc._x) - root.inGameBackMc._x;
_local2._x = mC._x + _local4;
_local2._y = mC._y - root.inGameBackMc._y;
_local2._x + 340;
}
remove();
}
}
function remove() {
var _local2 = 0;
while (_local2 < root.Game.enemyArray.length) {
if (this == root.Game.enemyArray[_local2]) {
arrayIndex = _local2;
}
_local2++;
}
mC.removeMovieClip();
root.Game.enemyArray.splice(_local2, 1);
}
function updatePosition() {
xPos = xPos + xVel;
yPos = yPos + yVel;
mC._x = xOrigin + xPos;
mC._y = yOrigin + yPos;
}
var xOrigin = 0;
var yOrigin = 0;
var xPos = 0;
var yPos = 0;
var xVel = 0;
var yVel = 0;
var angle = 0;
var degrees = 0;
var centerX = 0;
var centerY = 0;
var radius = 0;
var speed = 0;
var cost = 0;
var playerleft = 0;
var playerright = 0;
var gameObjectType = "";
var energyStart = 0;
var energy = 0;
var delayToFireMissile = 60;
var numberOfMissiles = 0;
}
Symbol 676 MovieClip [__Packages.Useful] Frame 0
class Useful
{
function Useful () {
}
function getDistance(xx1, yy1, xx2, yy2) {
var _local4 = xx1;
var _local3 = yy1;
var _local2 = xx2;
var _local1 = yy2;
_local2 = _local4 - _local2;
_local1 = _local3 - _local1;
return(Math.sqrt((_local2 * _local2) + (_local1 * _local1)));
}
function RandomNumber(x, y) {
return(Math.round(Math.random() * (y - x)) + x);
}
function getArcVelocity(gravity, speed, xStart, yStart, xEnd, yEnd) {
var _local1 = new Object();
var _local3 = xEnd - xStart;
var _local4 = yEnd - yStart;
var _local6 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
var _local2 = Math.ceil(_local6 / speed);
_local1.gravity = gravity;
_local1.steps = _local2;
_local1.xStep = _local3 / _local2;
_local1.yStep = _local4 / _local2;
if (gravity > 0) {
_local1.yStep = _local1.yStep - ((_local2 * gravity) / 2);
}
return(_local1);
}
function localToGlobalXY(mc1) {
var _local3 = new Object();
_local3.newX = 0;
_local3.newY = 0;
var _local2 = mc1;
while (_local2 != _root) {
var _local6 = _local3.newX * (_local2._xscale / 100);
var _local5 = _local3.newY * (_local2._yscale / 100);
var _local4 = _local2._rotation * (Math.PI/180);
_local3.newX = (_local6 * Math.cos(_local4)) - (_local5 * Math.sin(_local4));
_local3.newY = (_local6 * Math.sin(_local4)) + (_local5 * Math.cos(_local4));
_local3.newX = _local3.newX + _local2._x;
_local3.newY = _local3.newY + _local2._y;
_local2 = _local2._parent;
}
return(_local3);
}
function radian(degree) {
return((degree * Math.PI) / 180);
}
function addThrust(rot, speed) {
var _local2 = new Object();
_local2.xVel = Math.cos(radian(rot)) * speed;
_local2.yVel = Math.sin(radian(rot)) * speed;
return(_local2);
}
function getVectorFromAngle(rotationVar) {
var _local1 = new Object();
var _local2 = (rotationVar * Math.PI) / 180;
_local1.vx = Math.cos(_local2);
_local1.vy = Math.sin(_local2);
return(_local1);
}
function capVectorSpeed(vx, vy, max) {
var _local2 = new Object();
var _local1 = Math.sqrt((vx * vx) + (vy * vy));
if (_local1 > max) {
vx = vx * (max / _local1);
vy = vy * (max / _local1);
}
_local2.vx = vx;
_local2.vy = vy;
return(_local2);
}
function pointTowards(xx, yy, xx2, yy2) {
var _local1 = new Object();
var _local3 = xx - xx2;
var _local2 = yy - yy2;
_local1.spriteAngle = Math.atan2(_local2, _local3);
_local1.spriteRotation = (_local1.spriteAngle * 180) / Math.PI;
_local1.vx = Math.cos(_local1.spriteAngle);
_local1.vy = Math.sin(_local1.spriteAngle);
return(_local1);
}
function rotateXY(centerX, centerY, radius, ringAngle) {
var _local2 = (Math.PI * ringAngle) / 180;
var _local1 = new Object();
_local1.xPos = centerX + (Math.cos(_local2) * radius);
_local1.yPos = centerY + (Math.sin(_local2) * radius);
return(_local1);
}
}
Symbol 663 Button
on (release) {
gotoAndStop ("show_ow_anim");
}