Frame 1
System.security.loadPolicyFile("http://www.motionjam.com/fgm_ad_network.xml");
mochi.MochiServices.connect("307bb063c0391bf2");
MochiAd.showPreGameAd({id:"307bb063c0391bf2", res:"700x576"});
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__("c2dbd3e6", this, 10301, true);
Frame 2
sounds = new Object();
sounds.fire = new Sound();
sounds.fire.attachSound("Missile");
sounds.fireMissile = new Sound();
sounds.fireMissile.attachSound("Missile");
sounds.boing = new Sound();
sounds.boing.attachSound("boing");
musicObject = new Sound(this.createEmptyMovieClip("snd", 1000));
musicObject.attachSound("music");
sounds.doh = new Sound();
sounds.doh.attachSound("doh");
sounds.cheer = new Sound();
sounds.cheer.attachSound("cheer");
sounds.ExtraEnergy = new Sound();
sounds.ExtraEnergy.attachSound("GainBonus");
sounds.Artillery = new Sound();
sounds.Artillery.attachSound("Artillery");
sounds.Computer = new Sound();
sounds.Computer.attachSound("Computer");
sounds.LevelDefender = new Sound();
sounds.LevelDefender.attachSound("LevelDefender");
sounds.GameOverRobot = new Sound();
sounds.GameOverRobot.attachSound("GameOverRobot");
sounds.Appear = new Sound();
sounds.Appear.attachSound("Appear");
sounds.LoseEnergy = new Sound();
sounds.LoseEnergy.attachSound("ExUnderwaterShort");
musicObject.start(0, 1000);
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 mainLoop() {
runSounds();
if (Game.gameState == "setup") {
Player.mC.TurretMc.play();
Game.deleteMeter();
Presentation.splashScreenMc.removeMovieClip();
obj.vx = 0;
obj.vy = 0;
Background = new GameBackground(this, xLevelStart, yLevelStart, 8, Game.levelWidth, Game.levelHeight);
Game.lives = startLives;
Player = new GamePlayer(Game.playerMc, this, 100, 2540);
Game.score = 0;
Game.setLives();
Game.setScore();
Game.gameState = "pre_start";
} else if (Game.gameState == "restart") {
Player.mC.TurretMc.play();
Player.cannonMan.removeMovieClip();
Game.score = 0;
Game.setScore();
Background.xPos = xLevelStart;
Background.yPos = yLevelStart;
Game.gameState = "pre_start";
} else if (Game.gameState == "game_over_restart") {
Presentation.setupSplashScreen(splashScreenElements);
Background.backgroundMc.removeMovieClip();
Player.cannonMan.removeMovieClip();
Game.gameState = "waiting_to_start";
} else if (Game.gameState == "pre_start") {
Game.mainLoop();
Player.mainLoop();
Background.mainLoop();
} else if (Game.gameState == "start_game") {
Game.mainLoop();
} else if (Game.gameState == "play") {
Game.mainLoop();
Background.mainLoop();
}
}
function setupGoodGuy(mCName, xStart, yStart, grav, rg) {
var goodGuyMc = Game.inGameObjectsMc.attachMovie(mCName, "gg" + Game.numberOfDropped, Game.numberOfDropped);
var sp = Useful1.RandomNumber(5, 10);
sp = sp / 10;
Game.goodGuysArray.push(new GoodGuy(goodGuyMc, this, xStart, yStart, sp, mCName, grav, rg));
}
function setupPickups() {
var iy = 0;
while (iy < Game.levelHeightBlocks) {
var ix = 0;
while (ix < Game.levelWidthBlocks) {
var ind = ((iy * Game.levelWidthBlocks) + ix);
if ((iy == 0) or (iy == (Game.levelHeightBlocks - 3))) {
squareNamesArray[ind] = "edgeSquare";
} else if ((ix == 0) or (ix == (Game.levelWidthBlocks - 1))) {
squareNamesArray[ind] = "edgeSquare";
} else {
squareNamesArray[ind] = "square";
}
ix++;
}
iy++;
}
}
function setupPanel() {
ix = 0;
iy = 0;
ii = 0;
var i = 0;
while (i < gameObjectNames.length) {
var addd = Game.inGameStatsMc.ingamestatsmc;
addd = addd.wg;
trace(addd._name);
addd = addd["w" + (i + 1)];
trace(addd._name);
addd = addd.wb;
trace(addd._name);
Game.rightPanelGameObjects[i] = addd;
Game.rightPanelGameObjects[i].indexA = i;
Game.rightPanelGameObjects[i].gameObjectBtn.onRelease = clickRightPanelObject;
Game.rightPanelGameObjects[i].gameObjectBtn.onRollOver = rollOverRightPanelObject;
Game.rightPanelGameObjects[i].gameObjectBtn.onRollOut = rollOutRightPanelObject;
i++;
}
}
function clickRightPanelObject() {
trace(this._parent.indexA);
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() {
trace("roll over");
}
function rollOutRightPanelObject() {
trace("roll out");
}
function dropGameObject() {
var xx = _xmouse;
var yy = _ymouse;
if (Game.currentPickedUp != undefined) {
if (checkIfOverLapping() == true) {
var topBit = 0;
trace(Game.currentPickedUp.indexA);
var costOfGameObject = gameObjectCost[Game.currentPickedUp.indexA];
var money2 = Game.score;
money2 = money2 - costOfGameObject;
if (money2 >= 0) {
setupGoodGuy("magnet1", xx, yy, 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 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 titleInfo = {mCName:"title", xPos:75, yPos:30};
var playInfo = {mCName:"playBtnAnim", xPos:380, yPos:150};
var instructionsInfo = {mCName:"instructionsBtnAnim", xPos:270, yPos:220};
var controlsInfo = {mCName:"controlsBtnAnim", xPos:290, yPos:250};
var highscoresInfo = {mCName:"highscoresBtnAnim", xPos:270, yPos:315};
var SplashMusicBtn = {mCName:"SplashMusicBtn", xPos:490, yPos:358};
var splashScreenElements = [titleInfo, playInfo, instructionsInfo, controlsInfo, highscoresInfo, SplashMusicBtn];
var startLives = 3000;
mousePointer.onEnterFrame = function () {
this._x = _xmouse;
yOld = this._y;
this._y = _ymouse;
};
this.onMouseUp = function () {
mouseButton = 0;
if (Game.gameState == "play") {
obj.clip.guy.gotoAndStop(1);
Player.gliding = 0;
}
};
this.onMouseDown = function () {
mouseButton = 1;
if (_root._ymouse < 500) {
if (Game.gameState == "start_game") {
Game.deleteMeter();
Player.fireGun();
} else if (Game.gameState == "pre_start") {
Player.mC.TurretMc.stop();
Game.gameState = "start_game";
Game.setupMeter();
} else if (Game.gameState == "play") {
}
}
};
var soundControl = 1;
var soundFade;
var soundFadeControl = 100;
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 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 46 MovieClip [M_stars1] Frame 15
this.removeMovieClip();
Symbol 47 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 47 MovieClip [starAnim] Frame 24
this.removeMovieClip();
stop();
Symbol 77 MovieClip [gameOverMsgAnim] Frame 88
_parent._parent._parent._parent._parent.Game.gameState = "game_over_restart";
stop();
Symbol 80 MovieClip Frame 1
stop();
Symbol 82 Button
on (release) {
_parent._parent.play();
}
Symbol 85 Button
on (release) {
gotoAndStop ("submitScore");
}
Symbol 89 MovieClip Frame 1
stop();
Symbol 89 MovieClip Frame 4
play();
Symbol 89 MovieClip Frame 65
_parent._parent.play();
stop();
Symbol 89 MovieClip Frame 66
function moveOn() {
_parent._parent.play();
}
mochi.MochiScores.showLeaderboard({boardID:"82a0c2163cad0b29", score:_parent._parent._parent._parent._parent._parent._parent.Game.score, onClose:moveOn, onError:moveOn});
stop();
Symbol 91 MovieClip [loseLifeMsgAnim] Frame 10
stop();
Symbol 91 MovieClip [loseLifeMsgAnim] Frame 22
if (_parent._parent._parent._parent._parent.Game.gameState != "restart") {
_parent._parent._parent._parent._parent.Game.gameState = "restart";
}
this.removeMovieClip();
Symbol 97 MovieClip [getReadyMsgAnim] Frame 46
_parent._parent._parent._parent._parent.Game.gameState = "start_game";
this.removeMovieClip();
Symbol 110 MovieClip [levelCompleteMsgs] Frame 1
stop();
Symbol 112 MovieClip [levelCompleteMsgAnim] Frame 15
msg.titleMc.gotoAndStop(howWellDone);
Symbol 112 MovieClip [levelCompleteMsgAnim] Frame 31
_parent._parent._parent._parent._parent.Game.gameState = "display_bonus";
stop();
Symbol 112 MovieClip [levelCompleteMsgAnim] Frame 81
_parent._parent._parent._parent._parent.Game.gameState = "start_new_level";
stop();
Symbol 116 MovieClip [pausedMsgAnim] Frame 33
stop();
Symbol 116 MovieClip [pausedMsgAnim] Frame 42
this.removeMovieClip();
Symbol 135 MovieClip Frame 1
stop();
Symbol 137 MovieClip [CannonManRoll] Frame 1
stop();
Symbol 143 MovieClip [bullet] Frame 1
stop();
Symbol 149 MovieClip Frame 256
_parent.myObject.mCDeath();
Symbol 193 MovieClip Frame 1
stop();
Symbol 193 MovieClip Frame 13
myObject.fireNow();
Symbol 201 MovieClip Frame 1
stop();
Symbol 207 MovieClip [mainface] Frame 1
stop();
Symbol 211 MovieClip [goldLostAnim] Frame 16
this.removeMovieClip();
Symbol 216 MovieClip [square] Frame 1
stop();
Symbol 234 MovieClip Frame 1
stop();
Symbol 258 MovieClip [man with pistol anim] Frame 1
stop();
Symbol 274 MovieClip Frame 1
stop();
Symbol 345 Button
on (release) {
gotoAndStop (1);
}
Symbol 350 Button
on (release) {
mochi.MochiScores.closeLeaderboard();
gotoAndStop (1);
}
Symbol 351 MovieClip Frame 1
stop();
Symbol 351 MovieClip Frame 2
stop();
Symbol 351 MovieClip Frame 4
function moveOn() {
if (this._currentframe == 4) {
gotoAndStop (1);
}
}
var leaderBoardMc = this.createEmptyMovieClip("leaderBoard", 1);
leaderBoardMc._x = -340;
leaderBoardMc._y = -280;
mochi.MochiScores.showLeaderboard({boardID:"82a0c2163cad0b29", clip:leaderBoardMc, onClose:moveOn});
Symbol 359 MovieClip Frame 1
this.loadMovie("http://www.motionjam.com/fgm_ads/fgm_ad_v1.swf?" + Math.random(20));
Symbol 389 MovieClip Frame 1
stop();
Symbol 392 MovieClip Frame 1
stop();
Symbol 395 MovieClip Frame 1
stop();
Instance of Symbol 389 MovieClip in Symbol 410 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 392 MovieClip in Symbol 410 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 395 MovieClip in Symbol 410 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 389 MovieClip in Symbol 418 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 392 MovieClip in Symbol 418 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 395 MovieClip in Symbol 418 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 421 MovieClip Frame 1
stop();
Symbol 423 MovieClip [SplashMusicBtn] Frame 1
musicBtn.onRelease = function () {
if (musicMc._currentframe == 1) {
this._parent._parent._parent._parent._parent.soundFade = "out";
musicMc.gotoAndStop(2);
} else {
this._parent._parent._parent._parent._parent.soundFade = "in";
musicMc.gotoAndStop(1);
}
};
Symbol 424 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 != mochi.MochiServices.__get__clip()) || (mochi.MochiServices.__get__childClip()._target == undefined)) {
mochi.MochiServices.disconnect();
mochi.MochiServices.connect(mochi.MochiServices.__get__id(), options.clip);
}
delete options.clip;
}
if (options.name != null) {
if (typeof(options.name) == "object") {
if (options.name.text != undefined) {
options.name = options.name.text;
}
}
}
if (options.score != null) {
if (typeof(options.score) == "object") {
if (options.score.text != undefined) {
options.score = options.score.text;
}
}
}
if (options.onDisplay != null) {
options.onDisplay();
} else {
mochi.MochiServices.__get__clip().stop();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
mochi.MochiServices.__get__clip().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 closeLeaderboard() {
mochi.MochiServices.send("scores_closeLeaderboard");
}
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 scoresArrayToObjects(scores) {
var so = {};
var i;
var j;
var o;
var row_obj;
for (var item in scores) {
if (typeof(scores[item]) == "object") {
if ((scores[item].cols != null) && (scores[item].rows != null)) {
so[item] = [];
o = scores[item];
j = 0;
while (j < o.rows.length) {
row_obj = {};
i = 0;
while (i < o.cols.length) {
row_obj[o.cols[i]] = o.rows[j][i];
i++;
}
so[item].push(row_obj);
j++;
}
} else {
so[item] = {};
for (var param in scores[item]) {
so[item][param] = scores[item][param];
}
}
} else {
so[item] = scores[item];
}
}
return(so);
}
static function doClose(args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = "IOError";
}
onError.apply(null, [args.errorCode]);
} else {
onClose.apply();
}
}
}
Symbol 425 MovieClip [__Packages.mochi.MochiServices] Frame 0
class mochi.MochiServices
{
static var _id, _container, _clip, _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 get childClip() {
return(_clip);
}
static function getVersion() {
return("1.31");
}
static function allowDomains(server) {
var hostname = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(hostname);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(hostname);
}
}
return(hostname);
}
static function get isNetworkAvailable() {
if (System.security) {
var o = System.security;
if (o.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) && (_clip == undefined)) {
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
}
if (onError != undefined) {
mochi.MochiServices.onError = onError;
} else if (mochi.MochiServices.onError == undefined) {
mochi.MochiServices.onError = function (errorCode) {
trace(errorCode);
};
}
}
static function disconnect() {
if (_connected || (_connecting)) {
_connecting = (_connected = false);
flush(true);
if (_clip != undefined) {
_clip.removeMovieClip();
delete _clip;
}
_listenChannel.close();
_rcvChannel.close();
}
}
static function init(id, clip) {
_id = id;
if (clip != undefined) {
_container = clip;
} else {
_container = _root;
}
loadCommunicator(id, _container);
}
static function loadCommunicator(id, clip) {
var clipname = ("_mochiservices_com_" + id);
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
allowDomains(_gatewayURL);
_clip = clip.createEmptyMovieClip(clipname, 10336, false);
_loader = new MovieClipLoader();
if (_loaderListener.waitInterval != null) {
clearInterval(_loaderListener.waitInterval);
}
_loaderListener = {};
_loaderListener.onLoadError = function (target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
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();
return(_clip);
}
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);
trace("Waiting for MochiAds services to connect...");
}
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:_clip, version:getVersion()});
_rcvChannel.onStatus = function (infoObject) {
mochi.MochiServices.onStatus(infoObject);
};
_rcvChannel.onReceive = function (pkg) {
var cb = pkg.callbackID;
var cblst = this._callbacks[cb];
if (!cblst) {
return(undefined);
}
var method = cblst.callbackMethod;
var obj = cblst.callbackObject;
if (obj && (typeof(method) == "string")) {
method = obj[method];
}
if (method != undefined) {
method.apply(obj, pkg.args);
}
delete this._callbacks[cb];
};
_rcvChannel.onError = function () {
mochi.MochiServices.onError.apply(null, ["IOError"]);
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function flush(error) {
var request;
var callback;
while (_sendChannel._queue.length > 0) {
request = _sendChannel._queue.shift();
delete callback;
if (request.callbackID != null) {
callback = _rcvChannel._callbacks[request.callbackID];
}
delete _rcvChannel._callbacks[request.callbackID];
if (error) {
handleError(request.args, callback.callbackObject, callback.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 ((_clip == 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 426 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("2.2");
}
static function showPreGameAd(options) {
var DEFAULTS = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}};
options = _parseOptions(options, DEFAULTS);
var clip = options.clip;
var ad_msec = 11000;
var ad_timeout = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var wh = _getRes(options);
var w = wh[0];
var h = wh[1];
mc._x = w * 0.5;
mc._y = h * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = w * -0.5;
chk._y = h * -0.5;
var bar = chk.createEmptyMovieClip("_mochiad_bar", 4);
bar._x = 10;
bar._y = h - 20;
var bar_color = options.color;
delete options.color;
var bar_background = options.background;
delete options.background;
var bar_outline = options.outline;
delete options.outline;
var backing = bar.createEmptyMovieClip("_outline", 1);
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo(w - 20, 0);
backing.lineTo(w - 20, 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside = bar.createEmptyMovieClip("_inside", 2);
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo(w - 20, 0);
inside.lineTo(w - 20, 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside._xscale = 0;
var outline = bar.createEmptyMovieClip("_outline", 3);
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo(w - 20, 0);
outline.lineTo(w - 20, 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var p = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0) {
this._parent._alpha = p;
} else {
var _clip = this._parent._parent;
MochiAd.unload(_clip);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = function (width, height) {
};
mc.lc.adjustProgress = function (msec) {
var _chk = this.mc._mochiad_wait;
_chk.server_control = true;
_chk.started = getTimer();
_chk.ad_msec = msec;
};
chk.onEnterFrame = function () {
var _clip = this._parent._parent;
var ad_clip = this._parent._mochiad_ctr;
var elapsed = (getTimer() - this.started);
var finished = false;
var clip_total = _clip.getBytesTotal();
var clip_loaded = _clip.getBytesLoaded();
var clip_pcnt = ((100 * clip_loaded) / clip_total);
var ad_pcnt = ((100 * elapsed) / chk.ad_msec);
var _inside = this._mochiad_bar._inside;
var pcnt = Math.min(100, Math.min(clip_pcnt || 0, ad_pcnt));
pcnt = Math.max(this.last_pcnt, pcnt);
this.last_pcnt = pcnt;
_inside._xscale = pcnt;
if (!chk.showing) {
var total = ad_clip.getBytesTotal();
if ((total > 0) || (typeof(total) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (elapsed > chk.ad_timeout) {
finished = true;
}
}
if (elapsed > chk.ad_msec) {
finished = true;
}
if (((clip_total > 0) && (clip_loaded >= clip_total)) && (finished)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showInterLevelAd(options) {
var DEFAULTS = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}};
options = _parseOptions(options, DEFAULTS);
var clip = options.clip;
var ad_msec = 11000;
var ad_timeout = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var wh = _getRes(options);
var w = wh[0];
var h = wh[1];
mc._x = w * 0.5;
mc._y = h * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var p = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0) {
this._parent._alpha = p;
} else {
var _clip = this._parent._parent;
MochiAd.unload(_clip);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = function (width, height) {
};
mc.lc.adjustProgress = function (msec) {
var _chk = this.mc._mochiad_wait;
_chk.server_control = true;
_chk.started = getTimer();
_chk.ad_msec = msec - 250;
};
chk.onEnterFrame = function () {
var ad_clip = this._parent._mochiad_ctr;
var elapsed = (getTimer() - this.started);
var finished = false;
if (!chk.showing) {
var total = ad_clip.getBytesTotal();
if ((total > 0) || (typeof(total) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (elapsed > chk.ad_timeout) {
finished = true;
}
}
if (elapsed > chk.ad_msec) {
finished = true;
}
if (finished) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function showTimedAd(options) {
showInterLevelAd(options);
}
static function showPreloaderAd(options) {
showPreGameAd(options);
}
static function _allowDomains(server) {
var hostname = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(hostname);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(hostname);
}
}
return(hostname);
}
static function _loadCommunicator(options) {
var DEFAULTS = {clip:_root, com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = _parseOptions(options, DEFAULTS);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var clip = options.clip;
var clipname = ("_mochiad_com_" + options.id);
if (!_isNetworkAvailable()) {
return(null);
}
if (clip[clipname]) {
return(clip[clipname].lc);
}
var server = (options.com_server + options.id);
_allowDomains(server);
delete options.id;
delete options.com_server;
var depth = options.depth;
delete options.depth;
var mc = clip.createEmptyMovieClip(clipname, depth);
var lv = mc.createEmptyMovieClip("_mochiad_com", 1);
for (var k in options) {
lv[k] = options[k];
}
var lc = new LocalConnection();
var name = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
lc.mc = mc;
lc.name = name;
lc.allowDomain = function (d) {
return(true);
};
lc.allowInsecureDomain = lc.allowDomain;
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lc._id = 0;
lc._queue = [];
lc.rpcResult = function (cb_arg) {
var cb = parseInt(cb_arg);
var cblst = this._callbacks[cb];
if (!cblst) {
return(undefined);
}
delete this._callbacks[cb];
var args = [];
var i = 2;
while (i < cblst.length) {
args.push(cblst[i]);
i++;
}
var i = 1;
while (i < arguments.length) {
args.push(arguments[i]);
i++;
}
var method = cblst[1];
var obj = cblst[0];
if (obj && (typeof(method) == "string")) {
method = obj[method];
}
if (method) {
method.apply(obj, args);
}
};
lc._didConnect = function (endpoint) {
this._endpoint = endpoint;
var q = this._queue;
delete this._queue;
var ds = this.doSend;
var i = 0;
while (i < q.length) {
var item = q[i];
ds.apply(this, item);
i++;
}
};
lc.doSend = function (args, cbobj, cbfn) {
if (this._endpoint == null) {
var qargs = [];
var i = 0;
while (i < arguments.length) {
qargs.push(arguments[i]);
i++;
}
this._queue.push(qargs);
return(undefined);
}
this._id = this._id + 1;
var id = this._id;
if ((cbfn === undefined) || (cbfn === null)) {
cbfn = cbobj;
}
this._callbacks[id] = [cbobj, cbfn];
var slc = new LocalConnection();
var ss = slc.send(this._endpoint, "rpc", id, args);
};
lc._callbacks = {};
lc._callbacks[0] = [lc, "_didConnect"];
lv.st = getTimer();
lv.loadMovie(server + ".swf", "POST");
return(lc);
}
static function fetchHighScores(options, callbackObj, callbackMethod) {
var lc = _loadCommunicator({id:options.id});
if (!lc) {
return(false);
}
var fncall = ["fetchHighScores", options];
lc.doSend(["fetchHighScores", options], callbackObj, callbackMethod);
return(true);
}
static function sendHighScore(options, callbackObj, callbackMethod) {
var lc = _loadCommunicator({id:options.id});
if (!lc) {
return(false);
}
var fncall = ["sendHighScore", options];
lc.doSend(["sendHighScore", options], callbackObj, callbackMethod);
return(true);
}
static function load(options) {
var DEFAULTS = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, DEFAULTS);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var clip = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (clip._mochiad_loaded) {
return(null);
}
var depth = options.depth;
delete options.depth;
var mc = clip.createEmptyMovieClip("_mochiad", depth);
var wh = _getRes(options);
options.res = (wh[0] + "x") + wh[1];
options.server = options.server + options.id;
delete options.id;
clip._mochiad_loaded = true;
var lv = mc.createEmptyMovieClip("_mochiad_ctr", 1);
for (var k in options) {
lv[k] = options[k];
}
var server = lv.server;
delete lv.server;
var hostname = _allowDomains(server);
mc.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var lc = new LocalConnection();
var name = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
lc.mc = mc;
lc.name = name;
lc.hostname = hostname;
lc.allowDomain = function (d) {
return(true);
};
lc.allowInsecureDomain = lc.allowDomain;
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
lv.loadMovie(server + ".swf", "POST");
return(mc);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var o = System.security;
if (o.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var b = options.clip.getBounds();
var w = 0;
var h = 0;
if (typeof(options.res) != "undefined") {
var xy = options.res.split("x");
w = parseFloat(xy[0]);
h = parseFloat(xy[1]);
} else {
w = b.xMax - b.xMin;
h = b.yMax - b.yMin;
}
if ((w == 0) || (h == 0)) {
w = Stage.width;
h = Stage.height;
}
return([w, h]);
}
static function _parseOptions(options, defaults) {
var optcopy = {};
for (var k in defaults) {
optcopy[k] = defaults[k];
}
if (options) {
for (var k in options) {
optcopy[k] = options[k];
}
}
if (_root.mochiad_options) {
var pairs = _root.mochiad_options.split("&");
var i = 0;
while (i < pairs.length) {
var kv = pairs[i].split("=");
optcopy[unescape(kv[0])] = unescape(kv[1]);
i++;
}
}
if (optcopy.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(optcopy);
}
}
Symbol 427 MovieClip [__Packages.GamePlayer] Frame 0
class GamePlayer
{
var missileDistFromGun, root, shotsFired, shotsLimit, numberOfMissiles, scrollSpeed, keypress, jumpTime, mouseButton, gliding, mC, shotStrength, angleDir, cannonMan;
function GamePlayer (clip, rt, xStart, yStart) {
missileDistFromGun = 80;
xOrigin = xStart;
yOrigin = yStart;
dx = 0;
root = rt;
dy = 0;
angle = 100;
shotsFired = 0;
shotsLimit = 2;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
xVelOld = 0;
numberOfMissiles = 0;
yVelOld = 0;
scrollSpeed = 10;
keypress = 0;
jump = 0;
jumpTime = 10;
mouseButton = 0;
gliding = 0;
mC = clip;
shotStrength = 6;
angleDir = 4;
var gun = mC.attachMovie("Turret", "TurretMc", 1);
updatePosition();
}
function mainLoop() {
if (root.startReal == true) {
angle = mC.TurretMc.gun._rotation;
var ang = ((angle * Math.PI) / 180);
xVel = Math.cos(ang);
yVel = Math.sin(ang);
} else {
var temp = root.Useful1.localToGlobalXY(mC);
dy = temp.newY - _root.mousePointer._y;
dx = temp.newX - _root.mousePointer._x;
angle = Math.atan2(dy, dx);
mC.TurretMc.gun._rotation = (angle * 180) / Math.PI;
xVel = Math.cos(angle);
yVel = Math.sin(angle);
}
}
function fireGun() {
mC.TurretMc.gun.g5.cannon.myObject = this;
mC.TurretMc.gun.g5.cannon.play();
root.Game.gameState = "play";
}
function fireNow() {
root.Game.cannonManFlying = 1;
root.sounds.fire.start(0, 1);
var missileName = "bullet";
cannonMan = root.Game.ballMc.attachMovie(missileName, "man", 1);
root.obj.clip = cannonMan;
var cannonManShadow = root.Game.inGameMissilesMc.attachMovie("cannonManShadow", "manShadow", 200);
root.obj.shadowMc = cannonManShadow;
var endOfGunX = (-(xVel * missileDistFromGun));
var endOfGunY = (-(yVel * missileDistFromGun));
root.obj.x = mC._x + endOfGunX;
root.obj.y = mC._y + endOfGunY;
root.obj.y = root.obj.y + root.Background.yPos;
root.obj.y = root.obj.y - 40;
var ss = (shotStrength / 2);
root.obj.vx = -(xVel * ss);
root.obj.vy = -(yVel * ss);
root.Game.yeehawStart = 10;
}
function updatePosition() {
var oldX = mC._x;
var oldY = mC._y;
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 multidirectional = 0;
var dx = 0;
var dy = 0;
var angle = 0;
}
Symbol 428 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 429 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 dx = (mC._x - target.mC._x);
var dy = ((mC._y - 60) - target.mC._y);
var angle2 = Math.atan2(dy, dx);
mC.gun._rotation = (angle2 * 180) / Math.PI;
delayToFire--;
if (delayToFire == 0) {
delayToFire = 100;
var missileName = "bullet";
var mc = root.Game.inGameMissilesMc.attachMovie(missileName, "missile" + numberOfMissiles, numberOfMissiles);
var r = ((angle * 180) / Math.PI);
mc._rotation = r + 180;
numberOfMissiles++;
var missileDistFromGun = 40;
trace(mC._x);
trace(mC._y);
root.Game.missilesArray.push(new Missile2(mc, mC._x, mC._y, root, missileName));
}
}
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 yVel2 = yVel;
var yVel3 = yVel;
if (yVel3 < 0) {
yVel3 = (yVel3 - yVel3) - yVel3;
}
var xm = (mC._x + root.Background.mC._x);
var ym = (mC._y + root.Background.mC._y);
var i = 0;
while (i < int(yVel3)) {
if (root.Game.inGameBackgroundMc.hitTest(xm, ym + i, true)) {
trace("hit");
break;
}
i++;
}
trace(i);
yVel = yVel - int(yVel2);
yVel = i + yVel;
}
function moveEnemy() {
var yVel2 = yVel;
var yVel3 = yVel;
if (yVel3 < 0) {
yVel3 = (yVel3 - yVel3) - yVel3;
}
var xm = (mC._x + root.Background.mC._x);
var ym = (mC._y + root.Background.mC._y);
var i = 0;
while (i < int(yVel3)) {
if (root.Game.inGameBackgroundMc.hitTest(xm, ym + i, true)) {
trace("hit");
break;
}
i++;
}
trace(i);
yVel = yVel - int(yVel2);
yVel = i + yVel;
xVel = xDir * speed;
updatePosition();
var xm = (mC._x + root.Background.mC._x);
var ym = (mC._y + root.Background.mC._y);
if (root.Game.inGameBackgroundMc.hitTest(xm, ym + i, true)) {
var hit = 0;
var i = 0;
while (i < 10) {
yPos--;
mC._x = xOrigin + xPos;
mC._y = yOrigin + yPos;
if (root.Game.inGameBackgroundMc.hitTest(mC._x + root.scrollIndexX, mC._y, true) == false) {
trace("free");
hit = 1;
break;
}
i++;
}
if (hit == 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 e = (energy / 10);
trace(energyMc._name);
energyMc.bar.bar._y = int(10 - e);
if (energy <= 0) {
if (gotGold == 1) {
var sticky = root.inGameBackMc.attachMovie("goldLostAnim", "goldFound" + root.lostGold, root.lostGold);
sticky.g.g.text = "+1";
root.Game.increaseMoney();
var x1 = ((root.inGameBackMc._x - root.inGameBackMc._x) - root.inGameBackMc._x);
sticky._x = mC._x + x1;
sticky._y = mC._y - root.inGameBackMc._y;
sticky._x + 340;
trace(sticky._x);
trace(sticky._y);
}
remove();
}
}
function remove(i, i3) {
var 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 430 MovieClip [__Packages.Missile2] Frame 0
class Missile2
{
var root, mC, mType, velocities, arrayIndex;
function Missile2 (clip, xStart, yStart, rt, type, xv, yv) {
root = rt;
xOrigin = xStart;
yOrigin = yStart - 60;
xPos = 0;
yPos = 0;
xVel = 1;
yVel = 0;
mC = clip;
mType = type;
var tarX = root.Game.enemyArray[0].mC._x;
var tarY = root.Game.enemyArray[0].mC._y;
velocities = root.Useful.getArcVelocity(0, 10, xOrigin, yOrigin, tarX, tarY);
xVel = -(xv * 20);
yVel = -(yv * 20);
updatePosition();
}
function missileControl(ii) {
updatePosition();
applyGravity();
}
function checkForBug() {
var bugDist = root.getDistance(mC, root.home);
if (bugDist > 680) {
remove();
}
}
function createRock() {
var mc = root.rocksMc.attachMovie("rock", "rock" + root.rocksNumber, root.rocksNumber);
root.rocksNumber++;
mc._x = mC._x;
mc._y = mC._y;
root.deadSporesArray.push(mc);
}
function mCDeath() {
var explosion = root.Game.inGameExplosionsMc.attachMovie("explosion", "explosion" + root.scoreIndex, root.scoreIndex);
explosion._x = mC._x;
explosion._y = mC._y;
remove();
return(undefined);
}
function plotSticky(xx, yy) {
var sticky = root.inGameBackMc.attachMovie("StickyProjectile", "sticky" + root.stickies, root.stickies);
var x1 = ((root.inGameBackMc._x - root.inGameBackMc._x) - root.inGameBackMc._x);
sticky._x = mC._x + x1;
sticky._y = yy - root.inGameBackMc._y;
root.stickies++;
root.stickysArray.push(new Sticky(root, mC._x, mC._y, sticky));
}
function collisionDetection() {
if (yVel > 0) {
var yVel2 = yVel;
var yVel3 = yVel;
if (yVel3 < 0) {
yVel3 = (yVel3 - yVel3) - yVel3;
}
var hit = false;
var yHit = 0;
var i = 0;
while (i < int(yVel3)) {
var xm = (mC._x + root.Background.mC._x);
var ym = (mC._y + root.Background.mC._y);
if (root.Game.inGameBackgroundMc.hitTest(xm, ym + i, true)) {
mCDeath();
hit = true;
yHit = i;
i = int(yVel3);
}
i++;
}
if (hit == true) {
yVel = yVel - int(yVel2);
yVel = yHit + yVel;
}
}
var i = 0;
while (i < root.enemyArray.length) {
if (mC.hitTest(root.enemyArray[i].mC)) {
root.enemyArray[i].decreaseEnergy();
mCDeath();
}
i++;
}
}
function remove() {
var i1 = 0;
while (i1 < root.missilesArray.length) {
if (this == root.missilesArray[i1]) {
arrayIndex = i1;
}
i1++;
}
mC.removeMovieClip();
root.missilesArray.splice(arrayIndex, 1);
root.Player.shotsFired--;
if (root.Player.shotsFired < 0) {
root.Player.shotsFired = 0;
}
}
function checkForOffStage(ii) {
if (mC._x < 0) {
remove();
}
if (mC._y < 0) {
remove();
}
if (mC._x > root.Game.movieWidth) {
remove();
}
if (mC._y > 170) {
remove();
}
}
function applyGravity() {
yVel = yVel + 1;
}
function updatePosition() {
xPos = xPos + xVel;
yPos = yPos + yVel;
var oldX = mC._x;
var oldY = mC._y;
mC._x = xOrigin + xPos;
mC._y = yOrigin + yPos;
var dx = (mC._x - oldX);
var dy = (mC._y - oldY);
var angle2 = Math.atan2(dy, dx);
mC._rotation = (angle2 * 180) / Math.PI;
trace("missile y");
trace(mC._y);
}
var xOrigin = 0;
var yOrigin = 0;
var xPos = 0;
var yPos = 0;
var xVel = 0;
var yVel = 0;
}
Symbol 431 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) {
trace("sticky");
var yVel2 = yVel;
var yVel3 = yVel;
if (yVel3 < 0) {
yVel3 = (yVel3 - yVel3) - yVel3;
}
var hit = false;
var yHit = 0;
trace(mC._x);
trace(mC._y);
trace(root.inGameBackMc._x);
trace(root.inGameBackMc._y);
trace(xOrigin);
trace(yOrigin);
var x1 = ((root.inGameBackMc._x - root.inGameBackMc._x) - root.inGameBackMc._x);
var xx = (xOrigin + x1);
var obg = new Object();
obg.x1 = mC._x;
obg.y1 = mC._y;
root.inGameBackMc.localToGlobal(obg.x1, obg.y1);
var i = 0;
while (i < int(yVel3)) {
var xm = (mC._x + root.inGameBackMc._x);
xm = xm + root.scrollIndexX;
var ym = ((mC._y = mC._y + root.inGameBackMc._y));
ym = ym + 10;
if (root.inGameBackMc.hitTest(xm, ym + i, true)) {
hit = true;
yHit = i;
i = int(yVel3);
}
i++;
}
if (hit == true) {
trace("yHit");
trace(yHit);
yVel = yVel - int(yVel2);
yVel = yHit + yVel;
}
}
}
function remove() {
var i = 0;
while (i < root.stickysArray.length) {
if (this == root.stickysArray[i]) {
arrayIndex = i;
}
i++;
}
mC.removeMovieClip();
root.stickysArray.splice(arrayIndex, 1);
}
function applyGravity() {
yVel = yVel + 16;
}
function updatePosition() {
xPos = xPos + xVel;
yPos = yPos + yVel;
var oldX = mC._x;
var oldY = mC._y;
var x1 = ((root.inGameBackMc._x - root.inGameBackMc._x) - root.inGameBackMc._x);
var xx = (xOrigin + x1);
var yy = (yOrigin - root.inGameBackMc._y);
mC._x = xx + xPos;
mC._y = yy + yPos;
}
var xOrigin = 0;
var yOrigin = 0;
var xPos = 0;
var yPos = 0;
var xVel = 0;
var yVel = 0;
}
Symbol 432 MovieClip [__Packages.GamePresentation] Frame 0
class GamePresentation
{
var rt, mC, splashScreenMc, elementMc, btnType, myObject;
function GamePresentation (rt2) {
rt = rt2;
mC = rt.Game.presentationMc;
}
function setupSplashScreen(elementsPositions) {
splashScreenMc = mC.attachMovie("SplashScreen", "splashscreenmc", 1);
var i = 0;
while (i < elementsPositions.length) {
var info = elementsPositions[i];
elementMc = splashScreenMc.attachMovie(info.mCName, info.mCName, i);
elementMc._x = info.xPos;
elementMc._y = info.yPos;
if (info.mCName != "title") {
elementMc.btn.btnType = info.mCName;
elementMc.btn.splashScreenMc = splashScreenMc;
elementMc.btn.myObject = this;
elementMc.btn.onRelease = clickRightSplashSceenBtn;
elementMc.btn.onRollOver = rollOverSplashSceenBtn;
elementMc.btn.onRollOut = rollOutSplashSceenBtn;
}
i++;
}
}
function clickRightSplashSceenBtn() {
if (btnType == "playBtnAnim") {
myObject.rt.Game.gameState = "setup";
mochi.MochiScores.closeLeaderboard();
} else if (btnType == "instructionsBtnAnim") {
splashScreenMc.screens.gotoAndStop("showinstructions");
mochi.MochiScores.closeLeaderboard();
} else if (btnType == "controlsBtnAnim") {
splashScreenMc.screens.gotoAndStop("showcontrols");
mochi.MochiScores.closeLeaderboard();
} else if (btnType == "highscoresBtnAnim") {
if (splashScreenMc._currentframe != 4) {
splashScreenMc.screens.gotoAndStop("showhighscores");
}
}
}
function rollOverSplashSceenBtn() {
if (btnType == "playBtnAnim") {
} else if (btnType == "instructionsBtnAnim") {
} else if (btnType == "controlsBtnAnim") {
} else if (btnType == "highscoresBtnAnim") {
}
}
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 velocities = new Object();
var xd = (xEnd - xStart);
var yd = (yEnd - yStart);
var dist = Math.sqrt((xd * xd) + (yd * yd));
var steps = Math.ceil(dist / speed);
velocities.gravity = gravity;
velocities.steps = steps;
velocities.xStep = xd / steps;
velocities.yStep = yd / steps;
if (gravity > 0) {
velocities.yStep = velocities.yStep - ((steps * gravity) / 2);
}
return(velocities);
}
function localToGlobalXY(mc1) {
var temp = new Object();
temp.newX = 0;
temp.newY = 0;
var clip = mc1;
while (clip != _root) {
var xs = (temp.newX * (clip._xscale / 100));
var ys = (temp.newY * (clip._yscale / 100));
var r = (clip._rotation * (Math.PI/180));
temp.newX = (xs * Math.cos(r)) - (ys * Math.sin(r));
temp.newY = (xs * Math.sin(r)) + (ys * Math.cos(r));
temp.newX = temp.newX + clip._x;
temp.newY = temp.newY + clip._y;
clip = clip._parent;
}
return(temp);
}
function radian(degree) {
return((Math.PI/180) * degree);
}
function addThrust(rot, speed) {
var thrustVectors = new Object();
thrustVectors.xVel = Math.cos(radian(rot)) * speed;
thrustVectors.yVel = Math.sin(radian(rot)) * speed;
return(thrustVectors);
}
}
Symbol 433 MovieClip [__Packages.GameGame] Frame 0
class GameGame
{
var mC, rt, movieWidth, yeehawStart, movieHeight, blockSize, levelWidthBlocks, levelHeightBlocks, levelWidth, levelHeight, gameState, lostGold, 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, bestScore, starAnimDelay, lives, meterLevel, meterLevelSpeed, gameStartDelay, meterLevelDir, bounceCount, imflyingStart, xMidway, yMidway, starTrails, cannonManFlying, powerMeter, msgMc;
function GameGame (mc, rt2, sw, sh, levelW, levelH, startLives) {
mC = mc;
rt = rt2;
movieWidth = sw;
yeehawStart = 0;
movieHeight = sh;
blockSize = 32;
levelWidthBlocks = levelW;
levelHeightBlocks = levelH;
levelWidth = levelWidthBlocks * blockSize;
levelHeight = levelHeightBlocks * blockSize;
gameState = "loading";
lostGold = 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;
bestScore = 0;
starAnimDelay = 4;
lives = startLives;
meterLevel = 0;
meterLevelSpeed = 20;
gameStartDelay = 20;
meterLevelDir = meterLevelSpeed;
bounceCount = 0;
imflyingStart = 0;
xMidway = 0;
yMidway = 0;
starTrails = 0;
cannonManFlying = 0;
setupPanel();
}
function setupPanel() {
var statsMc = inGameStatsMc.attachMovie("weapons", "ingamestatsmc", 1);
statsMc._y = movieHeight - (blockSize * 2);
var addd = statsMc.wg;
addd = addd.stats;
addd.musicBtn.myObject = this;
addd.musicBtn.myMc = addd;
addd.quitBtn.myObject = this;
if (rt.soundSwitch == "off") {
addd.musicBtn._parent.music.gotoAndStop(2);
}
addd.musicBtn.onRelease = function () {
if (this.myMc.music._currentframe == 1) {
this.myObject.rt.soundFade = "out";
this.myMc.music.gotoAndStop("off");
} else {
this.myObject.rt.soundFade = "in";
this.myMc.music.gotoAndStop("on");
}
};
addd.quitBtn.onRelease = function () {
this.myObject.rt.Game.gameStartDelay = 10;
this.myObject.rt.Game.deleteMeter();
this.myObject.rt.Game.cannonManFlying = 0;
this.myObject.rt.obj.vx = 0;
this.myObject.rt.obj.vy = 0;
this.myObject.rt.obj.clip._rotation = 0;
this.myObject.rt.Game.msgMc.removeMovieClip();
this.myObject.rt.obj.shadowMc.removeMovieClip();
this.myObject.rt.Game.gameState = "restart";
};
}
function deleteMeter() {
powerMeter.removeMovieClip();
}
function displayMeter() {
rt.mousePointer.attachMovie("shotStrengthMeter", "meter", 2);
}
function setupMeter() {
powerMeter = playerMc.attachMovie("shotStrengthMeter", "meter", 2);
}
function gameOver(hitTop) {
yeehawStart = 0;
imflyingStart = 0;
if (gameState == "play") {
gameStartDelay = 10;
cannonManFlying = 0;
lives--;
rt.obj.vx = 0;
rt.obj.vy = 0;
rt.obj.clip._rotation = 0;
setLives();
if (score > bestScore) {
bestScore = score;
setBest();
}
if (lives == 0) {
gameState = "game_over";
msgMc = inGameMsgsMc.attachMovie("gameOverMsgAnim", "gameover", 1);
msgMc._x = movieWidth / 2;
msgMc._y = movieHeight / 2;
msgMc.m.msg.score.text = bestScore;
} else {
gameState = "lose_life";
msgMc = inGameMsgsMc.attachMovie("loseLifeMsgAnim", "loselife", 1);
msgMc._x = movieWidth / 2;
msgMc._y = movieHeight / 2;
if (hitTop == true) {
msgMc.m.msg.gotoAndPlay("notastro");
rt.obj.clip.gotoAndStop(1);
rt.sounds.doh.start(0, 1);
} else if (hitTop == false) {
if (score < 1000) {
msgMc.m.msg.gotoAndStop("bad");
rt.obj.clip.gotoAndStop(3);
rt.sounds.doh.start(0, 1);
} else if (score < 10000) {
msgMc.m.msg.gotoAndStop("ok");
rt.sounds.cheer.start(0, 1);
rt.obj.clip.gotoAndStop(4);
} else if (score < 35000) {
rt.obj.clip.gotoAndStop(4);
rt.sounds.cheer.start(0, 1);
msgMc.m.msg.gotoAndStop("good");
} else {
rt.obj.clip.gotoAndStop(4);
rt.sounds.cheer.start(0, 1);
msgMc.m.msg.gotoAndStop("good");
}
}
}
}
}
function scrollX() {
var xDiff = (rt.obj.x - xMidway);
rt.obj.x = xMidway;
rt.Background.xVel = xDiff;
var amountNotScrolled = rt.Background.scrollBackgroundH();
if (amountNotScrolled != xDiff) {
var ballToMove = amountNotScrolled;
rt.obj.x = rt.obj.x - ballToMove;
}
}
function scrollY() {
var yDiff = (rt.obj.y - yMidway);
trace("ydiff");
trace(yDiff);
rt.obj.y = yMidway;
trace(rt.obj.y);
rt.Background.yVel = yDiff;
var amountNotScrolled = rt.Background.scrollBackgroundV();
if (amountNotScrolled != yDiff) {
var ballToMove = amountNotScrolled;
rt.obj.y = rt.obj.y - ballToMove;
}
}
function mainLoop() {
var i = 0;
while (i < missilesArray.length) {
missilesArray[i].missileControl(i);
i++;
}
var i = 0;
while (i < enemyArray.length) {
enemyArray[i].main(i);
i++;
}
if (gameState == "start_game") {
rt.Player.shotStrength = -powerMeter.level._y;
}
if (gameState == "play") {
doStarTrail();
if (rt.obj.vy != 0) {
if (rt.Player.gliding == 0) {
rt.obj.vy = rt.obj.vy + 0.2;
} else {
rt.obj.vy = rt.obj.vy + 0.01;
}
xMidway = movieWidth / 2;
var xOld = rt.obj.x;
var yOld = rt.obj.y;
if (rt.obj.vx > 0) {
if (rt.obj.x == xMidway) {
rt.obj.x = rt.obj.x + rt.obj.vx;
if (rt.obj.x > xMidway) {
scrollX();
}
} else if (rt.obj.x < xMidway) {
rt.obj.x = rt.obj.x + rt.obj.vx;
if (rt.obj.x > xMidway) {
scrollX();
}
} else if (rt.obj.x > xMidway) {
rt.obj.x = rt.obj.x + rt.obj.vx;
if (rt.obj.x > 800) {
gameOver(false);
}
}
} else if (rt.obj.vx < 0) {
if (rt.obj.x == xMidway) {
rt.obj.x = rt.obj.x + rt.obj.vx;
if (rt.obj.x < xMidway) {
scrollX();
}
} else if (rt.obj.x < xMidway) {
rt.obj.x = rt.obj.x + rt.obj.vx;
if (rt.obj.x < 0) {
gameOver(false);
}
} else if (rt.obj.x > xMidway) {
rt.obj.x = rt.obj.x + rt.obj.vx;
if (rt.obj.x < xMidway) {
scrollX();
}
}
}
yMidway = movieHeight / 2;
trace("ymidway");
trace(yMidway);
if (rt.obj.vy > 0) {
if (rt.obj.y == yMidway) {
rt.obj.y = rt.obj.y + rt.obj.vy;
if (rt.obj.y > yMidway) {
scrollY();
}
} else if (rt.obj.y < yMidway) {
rt.obj.y = rt.obj.y + rt.obj.vy;
if (rt.obj.y > yMidway) {
scrollY();
}
} else if (rt.obj.y > yMidway) {
rt.obj.y = rt.obj.y + rt.obj.vy;
if (rt.obj.y > 300) {
rt.obj.clip.gotoAndStop("roll");
} else {
rt.obj.clip.gotoAndStop(1);
}
if (rt.obj.y > 450) {
rt.obj.vx = rt.obj.vx / 1.4;
if (rt.obj.vx < 0) {
if (rt.obj.vx > -1) {
gameOver(false);
}
} else if (rt.obj.vx < 1) {
gameOver(false);
}
rt.sounds.boing.start(0, 1);
bounceCount++;
if (bounceCount == 1) {
imflyingStart = 20;
}
rt.obj.vy = rt.obj.vy / 1.4;
if (rt.obj.vy < 0) {
rt.obj.vy = (rt.obj.vy - rt.obj.vy) - rt.obj.vy;
} else {
rt.obj.vy = -rt.obj.vy;
}
}
}
} else if (rt.obj.vy < 0) {
if (rt.obj.y < 300) {
rt.obj.clip.gotoAndStop(1);
}
trace("moving up");
if (rt.obj.y == yMidway) {
trace("middle");
rt.obj.y = rt.obj.y + rt.obj.vy;
if (rt.obj.y < yMidway) {
scrollY();
}
} else if (rt.obj.y < yMidway) {
trace("top");
trace(rt.obj.y);
rt.obj.y = rt.obj.y + rt.obj.vy;
trace(rt.obj.y);
trace(rt.obj.vy);
if (rt.obj.y < -50) {
gameOver(true);
}
} else if (rt.obj.y > yMidway) {
trace("bottom");
trace(rt.obj.y);
rt.obj.y = rt.obj.y + rt.obj.vy;
trace(rt.obj.y);
trace(rt.obj.vy);
if (rt.obj.y < yMidway) {
trace("scrollY");
scrollY();
}
}
}
} else {
rt.obj.x = rt.obj.x + rt.obj.vx;
rt.obj.y = rt.obj.y + rt.obj.vy;
}
increaseScore(rt.obj.vx);
}
rt.obj.clip._x = rt.obj.x;
rt.obj.clip._y = rt.obj.y;
if (rt.obj.y < 300) {
var angle2 = Math.atan2(rt.obj.vy, rt.obj.vx);
rt.obj.clip._rotation = (angle2 * 180) / Math.PI;
} else if (gameState == "play") {
if (cannonManFlying == 1) {
gameStartDelay--;
if (gameStartDelay == 0) {
gameStartDelay = 1;
rt.obj.clip._rotation = rt.obj.clip._rotation + int(rt.obj.vx * 2);
} else {
var angle2 = Math.atan2(rt.obj.vy, rt.obj.vx);
rt.obj.clip._rotation = (angle2 * 180) / Math.PI;
}
}
}
if (cannonManFlying == 1) {
rt.obj.shadowMc._y = 2580;
rt.obj.shadowMc._x = -rt.Background.xPos;
trace(rt.Background.xPos);
rt.obj.shadowMc._x = rt.obj.shadowMc._x + rt.obj.x;
var shadowScale = (rt.obj.y / 285);
shadowScale = shadowScale * 100;
rt.obj.shadowMc._xscale = shadowScale - 70;
rt.obj.shadowMc._yscale = rt.obj.shadowMc._xscale;
trace("shadow scale!!!!");
trace(shadowScale);
}
}
function doStarTrail() {
if (cannonManFlying == 1) {
starAnimDelay--;
if (starAnimDelay == 0) {
starAnimDelay = 4;
msgMc = inGameExplosionsMc.attachMovie("starAnim", "stars" + starTrails, starTrails);
msgMc._x = rt.obj.x;
msgMc._x = msgMc._x - rt.Background.xOrigin;
msgMc._x = msgMc._x - rt.Background.xPos;
msgMc._y = rt.obj.y;
msgMc._y = msgMc._y - rt.Background.yOrigin;
msgMc._y = msgMc._y - rt.Background.yPos;
starTrails++;
}
}
}
function decreaseScore() {
}
function increaseScore(increase) {
score = int(score + increase);
if (score > 0) {
setScore();
}
}
function setLives() {
var addd = inGameStatsMc.ingamestatsmc;
addd = addd.wg;
addd = addd.stats;
addd.lives.text = lives;
}
function setScore() {
var addd = inGameStatsMc.ingamestatsmc;
addd = addd.wg;
addd = addd.stats;
if (score < 10) {
addd.score.text = "0000" + score;
} else if (score < 100) {
addd.score.text = "000" + score;
} else if (score < 1000) {
addd.score.text = "00" + score;
} else if (score < 10000) {
addd.score.text = "0" + score;
} else {
addd.score.text = score;
}
}
function setBest() {
var addd = inGameStatsMc.ingamestatsmc;
addd = addd.wg;
addd = addd.stats;
if (bestScore < 10) {
addd.bestScore.text = "0000" + bestScore;
} else if (bestScore < 100) {
addd.bestScore.text = "000" + bestScore;
} else if (bestScore < 1000) {
addd.bestScore.text = "00" + bestScore;
} else if (bestScore < 10000) {
addd.bestScore.text = "0" + bestScore;
} else {
addd.bestScore.text = bestScore;
}
}
}
Symbol 434 MovieClip [__Packages.GameBackground] Frame 0
class GameBackground
{
var rt, maxScrollSpeed, xOrigin, yOrigin, xPos, yPos, xVel, yVel, xLevelWidth, yLevelHeight, backgroundMc, mC, backgroundParallaxMc;
function GameBackground (rt2, xs, ys, maxS, xm, ym) {
rt = rt2;
maxScrollSpeed = maxS;
xOrigin = 0;
yOrigin = 0;
xPos = xs;
yPos = ys;
xVel = 0;
yVel = 0;
xLevelWidth = xm - rt.Game.movieWidth;
yLevelHeight = ym - rt.Game.movieHeight;
backgroundMc = rt.Game.inGameBackgroundMc.attachMovie("background", "inGameBackMc", 0);
mC = rt.Game.inGameContainerMc;
updatePosition();
var ix = 1;
while (ix < 10) {
var ind = ix;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("frontScreenBack", "backgroundSquares" + ind, ind + 1);
backTile._x = backTile._x + (ix * 700);
backTile._y = backTile._y + 2478;
ix++;
}
var ix = 10;
while (ix < 15) {
var ind = ix;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("backgroundScrollCity", "backgroundSquares" + ind, ind + 1);
backTile._x = backTile._x + (ix * 700);
ix++;
}
var ix = 15;
while (ix < 20) {
var ind = ix;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("backgroundScrollMoutains", "backgroundSquares" + ind, ind + 1);
backTile._x = backTile._x + (ix * 700);
ix++;
}
var ind = 20;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("bgMountainsToDesert", "bgMD" + ind, ind + 1);
backTile._x = backTile._x + (ind * 700);
var ix = 21;
while (ix < 25) {
var ind = ix;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("bgdesert", "bgdesert" + ind, ind + 1);
backTile._x = backTile._x + (ix * 700);
ix++;
}
var ind = 25;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("backgroundDesertToBeach", "bgDB" + ind, ind + 1);
backTile._x = backTile._x + (ind * 700);
var ix = 26;
while (ix < 35) {
var ind = ix;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("bgIsland", "bgIsland" + ind, ind + 1);
backTile._x = backTile._x + (ix * 700);
ix++;
}
var ix = 2;
while (ix < 7) {
var ind = ix;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("satellite", "satellite" + ind, ind + 35);
backTile._x = backTile._x + (ix * 700);
backTile._x = backTile._x + rt.Useful1.RandomNumber(0, 300);
backTile._y = backTile._y + rt.Useful1.RandomNumber(100, 500);
ix++;
}
var ix = 6;
while (ix < 17) {
var ind = ix;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("heli", "heli" + ind, ind + 45);
backTile._x = backTile._x + (ix * 700);
backTile._x = backTile._x + rt.Useful1.RandomNumber(0, 500);
backTile._y = backTile._y + rt.Useful1.RandomNumber(1400, 2000);
ix++;
}
var ix = 2;
while (ix < 27) {
var ind = ix;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("bird", "bird" + ind, ind + 65);
backTile._x = backTile._x + (ix * 700);
backTile._x = backTile._x + rt.Useful1.RandomNumber(0, 500);
backTile._y = backTile._y + rt.Useful1.RandomNumber(1400, 2000);
ix++;
}
var ix = 15;
while (ix < 20) {
var ind = ix;
var backTile = rt.Game.inGameBackgroundMc.attachMovie("snowman", "snowman" + ind, ind + 85);
backTile._x = backTile._x + (ix * 700);
backTile._x = backTile._x + rt.Useful1.RandomNumber(0, 300);
backTile._y = backTile._y + 2540;
ix++;
}
backgroundParallaxMc = new Array();
var i = 0;
while (i < rt.parallaxLayersNames.length) {
backgroundParallaxMc[i] = rt.Game.inGameBackgroundParallaxMc.attachMovie(rt.parallaxLayersNames[i], "inGameBackPMc" + i, i);
backgroundParallaxMc[i]._x = backgroundParallaxMc[i]._x + (rt.Game.movieWidth / 2);
backgroundParallaxMc[i]._y = backgroundParallaxMc[i]._y + yOrigin;
backgroundParallaxMc[i]._alpha = 50 - (i * 20);
i++;
}
}
function mainLoop() {
if (rt.Game.gameState == "pre_start2") {
if (rt._xmouse > 650) {
xVel = xVel + 1;
var maxScrollSpeedNeg = (-maxScrollSpeed);
if (xVel < maxScrollSpeedNeg) {
xVel = maxScrollSpeedNeg;
}
scrollBackgroundH();
} else if (rt._xmouse < 50) {
xVel = xVel - 1;
if (xVel > maxScrollSpeed) {
xVel = maxScrollSpeed;
}
scrollBackgroundH();
} else if (xVel > 0) {
xVel = xVel - 2;
if (xVel < 1) {
xVel = 0;
} else {
scrollBackgroundH();
}
} else if (xVel < 0) {
xVel = xVel + 2;
if (xVel > -1) {
xVel = 0;
} else {
scrollBackgroundH();
}
}
if (rt._ymouse > 550) {
yVel = yVel + 1;
var maxScrollSpeedNeg = (-maxScrollSpeed);
if (yVel < maxScrollSpeedNeg) {
yVel = maxScrollSpeedNeg;
}
scrollBackgroundV();
} else if (rt._ymouse < 50) {
yVel = yVel - 1;
if (yVel > maxScrollSpeed) {
yVel = maxScrollSpeed;
}
scrollBackgroundV();
} else if (yVel > 0) {
yVel = yVel - 2;
if (yVel < 1) {
yVel = 0;
} else {
scrollBackgroundV();
}
} else if (yVel < 0) {
yVel = yVel + 2;
if (yVel > -1) {
yVel = 0;
} else {
scrollBackgroundV();
}
}
}
updatePosition();
}
function scrollBackgroundH() {
var xDiff = xVel;
xPos = xPos - xVel;
if (xVel > 0) {
var negNumber = -28000;
if (xPos < negNumber) {
xDiff = xPos - negNumber;
xPos = negNumber;
xVel = 0;
}
} else if (xPos > 0) {
xDiff = xPos;
xPos = 0;
xVel = 0;
}
var i = 0;
while (i < rt.parallaxLayersNames.length) {
backgroundParallaxMc[i]._x = backgroundParallaxMc[i]._x + (xVel / (3 + i));
i++;
}
return(xDiff);
}
function scrollBackgroundV() {
var yDiff = yVel;
yPos = yPos - yVel;
if (yVel > 0) {
var negNumber = rt.yLevelStart;
if (yPos < negNumber) {
trace("STOP SCROLL");
yDiff = yPos - negNumber;
yPos = negNumber;
yVel = 0;
}
} else if (yPos > 0) {
trace("STOP SCROLL");
yDiff = yPos;
yPos = 0;
yVel = 0;
}
var i = 0;
while (i < rt.parallaxLayersNames.length) {
backgroundParallaxMc[i]._y = backgroundParallaxMc[i]._y + (yVel / (3 + i));
i++;
}
return(yDiff);
}
function updatePosition() {
var oldX = mC._x;
var oldY = mC._y;
mC._x = xOrigin + xPos;
mC._y = yOrigin + yPos;
}
}
Symbol 435 MovieClip [__Packages.Useful] Frame 0
class Useful
{
function Useful () {
}
function getDistance(mc1, mc2) {
var dx2 = mc1._x;
var dy2 = mc1._y;
var dx = mc2._x;
var dy = mc2._y;
dx = dx2 - dx;
dy = dy2 - dy;
return(Math.sqrt((dx * dx) + (dy * dy)));
}
function RandomNumber(x, y) {
return(Math.round(Math.random() * (y - x)) + x);
}
function getArcVelocity(gravity, speed, xStart, yStart, xEnd, yEnd) {
var velocities = new Object();
var xd = (xEnd - xStart);
var yd = (yEnd - yStart);
var dist = Math.sqrt((xd * xd) + (yd * yd));
var steps = Math.ceil(dist / speed);
velocities.gravity = gravity;
velocities.steps = steps;
velocities.xStep = xd / steps;
velocities.yStep = yd / steps;
if (gravity > 0) {
velocities.yStep = velocities.yStep - ((steps * gravity) / 2);
}
return(velocities);
}
function localToGlobalXY(mc1) {
var temp = new Object();
temp.newX = 0;
temp.newY = 0;
var clip = mc1;
while (clip != _root) {
var xs = (temp.newX * (clip._xscale / 100));
var ys = (temp.newY * (clip._yscale / 100));
var r = (clip._rotation * (Math.PI/180));
temp.newX = (xs * Math.cos(r)) - (ys * Math.sin(r));
temp.newY = (xs * Math.sin(r)) + (ys * Math.cos(r));
temp.newX = temp.newX + clip._x;
temp.newY = temp.newY + clip._y;
clip = clip._parent;
}
return(temp);
}
function radian(degree) {
return((Math.PI/180) * degree);
}
function addThrust(rot, speed) {
var thrustVectors = new Object();
thrustVectors.xVel = Math.cos(radian(rot)) * speed;
thrustVectors.yVel = Math.sin(radian(rot)) * speed;
return(thrustVectors);
}
}