Frame 1
currentDomain = _root._url.split("/");
currentDomain = currentDomain[2];
Frame 2
MochiAd.showPreloaderAd({id:"540aa9e96ec8c870", res:"550x400"});
Stage.showMenu = false;
Frame 9
function fadeInSound(sound, id) {
clearInterval(this[id]);
sound.start();
this[id] = setInterval(this, "fadeIn", 10, sound, id);
}
function fadeIn(sound, id) {
sound.setVolume(sound.getVolume() + 1);
if (sound.getVolume() >= soundVolume) {
clearInterval(this[id]);
}
}
function fadeOutSound(sound, id) {
clearInterval(this[id]);
this[id] = setInterval(this, "fadeOut", 10, sound, id);
}
function fadeOut(sound, id) {
sound.setVolume(sound.getVolume() - 1);
if (sound.getVolume() <= 0) {
clearInterval(this[id]);
sound.stop();
}
}
function playSoundLoop(sound, times) {
sound.setVolume(100);
sound.start(0, times);
}
function playSound(sound) {
sound.setVolume(100);
sound.start(0, 1);
}
var PATH = "http://www.robotjamgames.com/bob/";
var GAMENAME = "bob";
so = SharedObject.getLocal("bob");
if (so.data.bestScore == undefined) {
so.data.bestScore = 0;
}
this.createEmptyMovieClip("soundholder1", 10000);
this.createEmptyMovieClip("soundholder2", 10001);
this.createEmptyMovieClip("soundholder3", 10002);
this.createEmptyMovieClip("soundholder4", 10003);
this.createEmptyMovieClip("cheerholder", 10005);
loop1 = new Sound(soundholder1);
loop1.attachSound("loop1");
loop1.setVolume(0);
loop2 = new Sound(soundholder2);
loop2.attachSound("loop2");
loop2.setVolume(0);
loop3 = new Sound(soundholder3);
loop3.attachSound("loop3");
loop3.setVolume(0);
loop4 = new Sound(soundholder4);
loop4.attachSound("loop4");
loop4.setVolume(0);
cheer = new Sound(cheerholder);
cheer.attachSound("cheer");
cheer.setVolume(100);
var id1;
var id2;
var id3;
var id4;
var id5;
var soundVolume = 100;
fadeInSound(loop1, "id1");
loop1.onSoundComplete = function () {
loop1.start(0, 999);
};
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__("c4d81627", this, 10301, true);
Frame 10
stop();
highScoreBox._visible = false;
var score = 0;
playGame.onRelease = function () {
fadeOutSound(loop1, "id1");
gotoAndPlay ("fade");
};
instructions.onRelease = function () {
gotoAndPlay ("instructs");
};
sendtofriend.onRelease = function () {
gotoAndPlay ("send");
};
highScores.onRelease = function () {
gotoAndPlay ("highscores");
};
Frame 30
highScoreBox.sorry._visible = false;
highScoreBox._visible = true;
highScoreBox.loading.gotoAndPlay(1);
highScoreBox.loading._visible = true;
highScoreBox.yourBest = so.data.bestScore;
myVars = new LoadVars();
myVars.onLoad = function (success) {
if (success) {
highScoreBox.loading._visible = false;
LoadHighScores();
} else {
highScoreBox.sorry._visible = true;
}
};
rn = Math.round(Math.random() * 1000000);
myVars.load((PATH + "get_score_today.php?flash=1?rn=") + rn, 0);
back.onPress = function () {
highScoreBox._visible = false;
gotoAndPlay ("options");
};
var scorePos = 0;
highScoreBox.scoreUp.onRelease = function () {
if (this._parent._parent.scorePos != 0) {
this._parent._parent.scorePos--;
this._parent._parent.LoadHighScores();
}
};
highScoreBox.scoreDown.onRelease = function () {
if (this._parent._parent.scorePos != 4) {
this._parent._parent.scorePos++;
this._parent._parent.LoadHighScores();
}
};
initialScores = function () {
var _local1 = 1;
while (_local1 <= 50) {
myVars["name" + _local1] = "none";
myVars["score" + _local1] = 0;
_local1++;
}
};
LoadHighScores = function () {
var _local1 = 1;
while (_local1 <= 10) {
highScoreBox["num" + _local1] = _local1 + (scorePos * 10);
highScoreBox["name" + _local1] = myVars["name" + ((scorePos * 10) + _local1)];
highScoreBox["score" + _local1] = myVars["score" + ((scorePos * 10) + _local1)];
_local1++;
}
};
highScoreBox.today.onRelease = function () {
highScoreBox.hiScoresTitle.text = "TODAYS HISCORES";
highScoreBox.loading.gotoAndPlay(1);
highScoreBox.loading._visible = true;
initialScores();
myVars.load((PATH + "get_score_today.php?flash=1?rn=") + rn, 0);
};
highScoreBox.alltime.onRelease = function () {
highScoreBox.hiScoresTitle.text = "ALL TIME HISCORES";
highScoreBox.loading.gotoAndPlay(1);
highScoreBox.loading._visible = true;
initialScores();
myVars.load((PATH + "get_score.php?flash=1?rn=") + rn, 0);
};
initialScores();
stop();
Frame 46
stop();
back.onRelease = function () {
gotoAndPlay ("options");
};
Frame 62
stop();
back.onRelease = function () {
gotoAndPlay ("options");
};
Frame 87
stop();
Frame 96
stop();
var choice = 0;
yourScore.scoreText.text = score;
so.data.yourScore = score;
this.createEmptyMovieClip("highSender", this.getNextHighestDepth());
if (score > so.data.bestScore) {
trace("new best");
so.data.bestScore = score;
}
this.yourScore.submitCover.bestScore.text = so.data.bestScore;
yourScore.backMenu.onPress = function () {
play();
};
yourScore.submit._alpha = 50;
yourScore.submit.enabled = false;
yourScore.submit.onRelease = function () {
highSender.pass = "bob";
highSender.playerName = yourScore.nameText;
highSender.score = score;
highSender.gameName = GAMENAME;
highSender.loadVariables(PATH + "new_score.php", "POST");
choice = 1;
play();
};
onEnterFrame = function () {
if (yourScore.nameText != eval("NULL")) {
yourScore.submit._alpha = 100;
yourScore.submit.enabled = true;
}
};
fadeInSound(loop1, "id1");
fadeOutSound(loop2, "id2");
fadeOutSound(loop3, "id3");
fadeOutSound(loop4, "id4");
Frame 103
if (choice == 0) {
gotoAndStop ("options");
} else {
gotoAndPlay ("highscores");
}
Symbol 3 MovieClip [ballpop] Frame 6
this.removeMovieClip();
Symbol 9 MovieClip [powerup] Frame 1
stop();
Symbol 13 MovieClip [bullet] Frame 58
this._parent._parent.bubbleRelease = false;
this._parent._parent.creating = false;
this._parent._parent.bullsActive--;
this.removeMovieClip();
Symbol 20 MovieClip Frame 1
stop();
Instance of Symbol 19 MovieClip "legitlogo" in Symbol 20 MovieClip Frame 1
on (release) {
getURL ("http://www.legitgames.com", "_blank");
}
Symbol 235 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function showPreloaderAd(options) {
var _local29 = {clip:_root, ad_msec:11000, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812};
options = _parseOptions(options, _local29);
var _local15 = options.clip;
var _local25 = options.ad_msec;
delete options.ad_msec;
var _local28 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
return(null);
}
_local15.stop();
var mc = _local15._mochiad;
mc.onUnload = function () {
this._parent.play();
};
var _local16 = _getRes(options);
var _local5 = _local16[0];
var _local14 = _local16[1];
mc._x = _local5 * 0.5;
mc._y = _local14 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local5 * -0.5;
chk._y = _local14 * -0.5;
var _local8 = chk.createEmptyMovieClip("_mochiad_bar", 4);
_local8._x = 10;
_local8._y = _local14 - 20;
var _local24 = options.color;
delete options.color;
var _local21 = options.background;
delete options.background;
var _local26 = options.outline;
delete options.outline;
var _local6 = _local8.createEmptyMovieClip("_outline", 1);
_local6.beginFill(_local21);
_local6.moveTo(0, 0);
_local6.lineTo(_local5 - 20, 0);
_local6.lineTo(_local5 - 20, 10);
_local6.lineTo(0, 10);
_local6.lineTo(0, 0);
_local6.endFill();
var _local4 = _local8.createEmptyMovieClip("_inside", 2);
_local4.beginFill(_local24);
_local4.moveTo(0, 0);
_local4.lineTo(_local5 - 20, 0);
_local4.lineTo(_local5 - 20, 10);
_local4.lineTo(0, 10);
_local4.lineTo(0, 0);
_local4.endFill();
_local4._xscale = 0;
var _local7 = _local8.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local26, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local5 - 20, 0);
_local7.lineTo(_local5 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local25;
chk.ad_timeout = _local28;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local12 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local10 = (100 * _local8) / _local4;
var _local11 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local2 = Math.min(100, Math.min(_local10 || 0, _local11));
_local2 = Math.max(this.last_pcnt, _local2);
this.last_pcnt = _local2;
_local9._xscale = _local2;
if (!chk.showing) {
var _local7 = _local12.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local5 > chk.ad_timeout) {
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showTimedAd(options) {
var _local15 = {clip:_root, ad_msec:11000, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd"};
options = _parseOptions(options, _local15);
var _local6 = options.clip;
var _local12 = options.ad_msec;
delete options.ad_msec;
var _local14 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
return(null);
}
_local6.stop();
var mc = _local6._mochiad;
mc.onUnload = function () {
this._parent.play();
};
var _local7 = _getRes(options);
var _local16 = _local7[0];
var _local13 = _local7[1];
mc._x = _local16 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local12;
chk.ad_timeout = _local14;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function load(options) {
var _local14 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local14);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = "1.3";
var _local7 = options.clip;
if (!_isNetworkAvailable()) {
return(false);
}
if (_local7._mochiad_loaded) {
return(false);
}
var _local13 = options.depth;
delete options.depth;
var _local6 = _local7.createEmptyMovieClip("_mochiad", _local13);
var _local12 = _getRes(options);
options.res = (_local12[0] + "x") + _local12[1];
options.server = options.server + options.id;
delete options.id;
_local7._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
if (_local7._url.indexOf("http") != 0) {
options.no_page = true;
}
var _local11 = _local4.server;
delete _local4.server;
var _local10 = _local11.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local10);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local10);
}
}
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local9 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local9;
_local5.hostname = _local10;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local9);
_local6.lc = _local5;
_local4.lc = _local9;
_local4.st = getTimer();
_local4.loadMovie(_local11 + ".swf", "POST");
return(_local6);
}
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 _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local4);
}
}
Instance of Symbol 19 MovieClip "legitlogo" in Symbol 29 MovieClip Frame 1
on (release) {
getURL ("http://www.legitgames.com", "_blank");
}
Instance of Symbol 28 MovieClip in Symbol 29 MovieClip Frame 1
on (release) {
getURL ("http://www.robotjam.com/games", "_blank");
}
Symbol 95 MovieClip Frame 20
gotoAndPlay (2);
Symbol 104 MovieClip Frame 1
Symbol 123 MovieClip Frame 1
stop();
Symbol 123 MovieClip Frame 10
stop();
Symbol 126 Button
on (release) {
sendToFriend.loadVariables(_root.PATH + "email.php", "POST");
sendemail._visible = false;
sendToFriend.gotoAndStop("sent");
}
Symbol 137 Button
on (release) {
getURL ("http://www.robotjam.com/games/", "_blank");
}
Symbol 160 MovieClip Frame 1
stop();
Symbol 160 MovieClip Frame 19
gotoAndStop ("idle");
Symbol 160 MovieClip Frame 29
gotoAndStop ("idle");
Symbol 160 MovieClip Frame 39
gotoAndStop ("idle");
Symbol 160 MovieClip Frame 49
gotoAndStop ("idle");
Symbol 178 MovieClip Frame 1
stop();
Symbol 178 MovieClip Frame 12
gotoAndStop ("start");
Symbol 178 MovieClip Frame 30
gotoAndStop ("start");
Symbol 178 MovieClip Frame 41
gotoAndPlay ("blow");
Symbol 180 MovieClip Frame 3
stop();
Symbol 181 MovieClip Frame 1
eyelids.play();
var blink = Math.round(Math.random() * 200);
var counter = 1;
this.createEmptyMovieClip("blinker", this.getNextHighestDepth());
blinker.onEnterFrame = function () {
counter++;
if (counter == blink) {
eyelids.play();
counter = 0;
blink = Math.round(Math.random() * 200);
}
};
Symbol 192 MovieClip Frame 1
if (moving == "idle") {
play();
}
if (moving == "left") {
gotoAndPlay ("left");
}
if (moving == "right") {
gotoAndPlay ("right");
}
Symbol 192 MovieClip Frame 16
gotoAndPlay ("idle");
Symbol 192 MovieClip Frame 22
head.eyes.gotoAndPlay("left");
Symbol 192 MovieClip Frame 33
if (moving == "idle") {
gotoAndPlay ("idle");
}
if (moving == "left") {
gotoAndPlay ("left");
}
if (moving == "right") {
gotoAndPlay ("right");
}
Symbol 192 MovieClip Frame 43
head.eyes.gotoAndPlay("right");
Symbol 192 MovieClip Frame 54
if (moving == "idle") {
gotoAndPlay ("idle");
}
if (moving == "left") {
gotoAndPlay ("left");
}
if (moving == "right") {
gotoAndPlay ("right");
}
Symbol 192 MovieClip Frame 64
head.eyes.gotoAndPlay("up");
Symbol 192 MovieClip Frame 74
gotoAndPlay ("idle");
Symbol 192 MovieClip Frame 84
head.eyes.gotoAndPlay("down");
Symbol 192 MovieClip Frame 93
gotoAndPlay ("idle");
Symbol 192 MovieClip Frame 104
head.eyes.gotoAndPlay("down");
Symbol 192 MovieClip Frame 110
head.eyes.gotoAndPlay("up");
Symbol 192 MovieClip Frame 128
gotoAndPlay ("idle");
Symbol 192 MovieClip Frame 135
head.eyes.gotoAndPlay("down");
head.mouth.gotoAndPlay("smile");
Symbol 192 MovieClip Frame 141
head.eyes.gotoAndPlay("up");
Symbol 192 MovieClip Frame 159
stop();
Symbol 218 MovieClip Frame 1
stop();
Symbol 218 MovieClip Frame 48
this._parent._parent.play();
Symbol 219 MovieClip Frame 1
instructions.playGame.onRelease = function () {
gotoAndStop ("game");
};
stop();
_parent.fadeInSound(_parent.loop2, "id2");
_parent.loop2.onSoundComplete = function () {
_parent.playSoundLoop(_parent.loop3, 1);
};
_parent.loop3.onSoundComplete = function () {
_parent.playSoundLoop(_parent.loop4, 1);
};
_parent.loop4.onSoundComplete = function () {
_parent.playSoundLoop(_parent.loop2, 1);
};
Symbol 219 MovieClip Frame 11
function createPowerUp(ballx, bally, dir, sizeScale, elasticity) {
pCount++;
powersActive++;
var _local2 = "powers" + bCount;
powers.attachMovie("powerup", _local2, this.getNextHighestDepth);
powers[_local2].powerUpType = Math.round((Math.random() * 3) + 1);
powers[_local2].gotoAndStop(powers[_local2].powerUpType);
powers[_local2]._x = ballx;
powers[_local2]._y = bally;
powers[_local2].dx = dir;
powers[_local2].dy = 2;
powers[_local2].onEnterFrame = function () {
this._x = this._x + this.dx;
this._y = this._y + this.dy;
if ((this._x + (this._width / 2)) > STAGEWIDTH) {
this._x = STAGEWIDTH - (this._width / 2);
this.dx = this.dx * -1;
}
if ((this._x - (this._width / 2)) < 0) {
this._x = 0 + (this._width / 2);
this.dx = this.dx * -1;
}
if ((this._y + (this._height / 2)) > STAGEHEIGHT) {
this._y = STAGEHEIGHT - (this._height / 2);
this.dy = this.dy * elasticity;
}
this.dy = this.dy + 0.1;
if (this.hitTest(bullets) || (this.hitTest(panda))) {
givePowerUp(this.powerUpType);
powersActive--;
createPop(this._x, this._y, this.sizeScale);
delete this.onEnterFrame;
this.removeMovieClip();
}
if (gameOverTest) {
createPop(this._x, this._y, this.sizeScale);
delete this.onEnterFrame;
}
};
}
function createBalls(ballx, bally, dir, sizeScale, elasticity) {
ballsActive++;
bCount++;
var bouncedOver = false;
var firstBounce = 0;
var bouncy = -1.1;
var _local3 = "ball" + bCount;
var popCounter = 0;
var finalPop = Math.round(Math.random() * 20);
balls.attachMovie("ball", _local3, bCount);
balls[_local3]._x = ballx;
balls[_local3]._y = bally;
balls[_local3].dx = dir;
balls[_local3].dy = 2;
balls[_local3].sizeScale = sizeScale;
switch (sizeScale) {
case 1 :
balls[_local3]._xscale = 100;
balls[_local3]._yscale = 100;
break;
case 2 :
balls[_local3]._xscale = 50;
balls[_local3]._yscale = 50;
break;
case 3 :
balls[_local3]._xscale = 25;
balls[_local3]._yscale = 25;
}
balls[_local3].onEnterFrame = function () {
if (powerUpGot == 2) {
this._x = this._x + (this.dx / 4);
this._y = this._y + (this.dy / 4);
} else {
this._x = this._x + this.dx;
this._y = this._y + this.dy;
}
if ((this._x + (this._width / 2)) > STAGEWIDTH) {
this._x = STAGEWIDTH - (this._width / 2);
this.dx = this.dx * -1;
}
if ((this._x - (this._width / 2)) < 0) {
this._x = 0 + (this._width / 2);
this.dx = this.dx * -1;
}
if ((this._y + (this._height / 2)) > STAGEHEIGHT) {
this._y = STAGEHEIGHT - (this._height / 2);
if (!firstBounce) {
this.dy = this.dy * elasticity;
} else {
this.dy = this.dy * bouncy;
}
firstBounce = 1;
}
if (((this._y - (this._height / 2)) < 0) && (!bouncedOver)) {
this._y = 0 + (this._height / 2);
bouncy = bouncy + 0.1;
bouncedOver = true;
}
this.dy = this.dy + 0.1;
if (panda.hit == false) {
if (this.hitTest(panda.collision)) {
pandaHit();
ballsActive--;
if (this.sizeScale < 3) {
createBalls(this._x + 10, this._y, 5, this.sizeScale + 1, -1.5);
createBalls(this._x - 10, this._y, -5, this.sizeScale + 1, -1.5);
}
createPop(this._x, this._y, this.sizeScale);
delete this.onEnterFrame;
this.removeMovieClip();
}
}
if (this.hitTest(bullets) || (powerUpGot == 1)) {
bullsActive--;
ballsActive--;
_root.score = _root.score + 10;
_root.scoreBox.scoreText.text = _root.score;
if (this.sizeScale < 3) {
createBalls(this._x + 10, this._y, 5, this.sizeScale + 1, -1.2);
createBalls(this._x - 10, this._y, -5, this.sizeScale + 1, -1.2);
}
createPop(this._x, this._y, this.sizeScale);
delete this.onEnterFrame;
this.removeMovieClip();
}
if (gameOverTest) {
popCounter++;
if (popCounter == finalPop) {
createPop(this._x, this._y, this.sizeScale);
delete this.onEnterFrame;
this.removeMovieClip();
}
}
};
}
function createPop(popx, popy, size) {
popCounter++;
this.createEmptyMovieClip("ballPop" + popCounter, this.getNextHighestDepth());
this["ballPop" + popCounter].attachMovie("ballPop", this["ball" + popCounter], this.getNextHighestDepth());
this["ballPop" + popCounter]._x = popx;
this["ballPop" + popCounter]._y = popy;
switch (size) {
case 1 :
this["ballPop" + popCounter]._xscale = 100;
this["ballPop" + popCounter]._yscale = 100;
break;
case 2 :
this["ballPop" + popCounter]._xscale = 50;
this["ballPop" + popCounter]._yscale = 50;
break;
case 3 :
this["ballPop" + popCounter]._xscale = 25;
this["ballPop" + popCounter]._yscale = 25;
}
}
function createBullet() {
if (!creating) {
bullCount++;
var _local2 = "bull" + bullCount;
var scalefactor = 100;
var bubbleCounter = 0;
bullets.attachMovie("bullet", _local2, this.getNextHighestDepth());
bullets[_local2]._y = panda._y - 10;
bullets[_local2]._x = panda._x;
bullets[_local2].desty = -50;
creating = true;
bullsActive++;
}
bullets[_local2].onEnterFrame = function () {
bubbleCounter++;
if (bubbleCounter >= 25) {
bubbleRelease = true;
}
if (!bubbleRelease) {
this._x = panda._x;
this._xscale = scalefactor;
this._yscale = scalefactor;
scalefactor = scalefactor + 40;
}
if (bubbleRelease) {
var _local2 = this.desty + this._y;
this._y = this._y - (_local2 * 0.05);
this._xscale = scalefactor;
this._yscale = scalefactor;
scalefactor = scalefactor + 10;
}
};
}
function pandaHit() {
panda.gotoAndPlay("perfect");
this.panda.head.mouth.gotoAndPlay("rasp");
panda.hit = true;
panda.canMove = false;
panda.health--;
healthBar.gotoAndStop(panda.health + 1);
var invincibleCounter = 0;
this.createEmptyMovieClip("invinciblePanda", this.getNextHighestDepth());
invinciblePanda.onEnterFrame = function () {
invincibleCounter++;
if ((invincibleCounter % 2) == 1) {
panda._alpha = 50;
} else {
panda._alpha = 100;
}
if (invincibleCounter == 15) {
panda.canMove = true;
}
if (invincibleCounter == 150) {
panda.hit = false;
panda._alpha = 100;
delete this.onEnterFrame;
this.removeMovieClip();
}
};
}
_parent.playSound(_parent.cheer);
this.createEmptyMovieClip("balls", this.getNextHighestDepth());
this.createEmptyMovieClip("bullets", this.getNextHighestDepth());
this.createEmptyMovieClip("powers", this.getNextHighestDepth());
var STAGEWIDTH = 550;
var STAGEHEIGHT = 400;
var frameNum = 1;
var ballsActive = 0;
var bullsActive = 0;
var powersActive = 0;
var bCount = 0;
var pCount = 0;
var bullCount = 0;
var popCount = 1;
var creating = false;
var ballInterval = 250;
var powerupInterval = 500;
var bubbleRelease = false;
var gameOverTest = false;
var powerUpGot = 0;
panda.gotoAndPlay("perfect");
panda.collision._visible = false;
panda.destx = STAGEWIDTH / 2;
panda.hit = false;
panda.canMove = true;
panda.health = 3;
panda.moving = "idle";
panda.moveRate = 0.15;
healthBar.gotoAndStop(panda.health + 1);
createBalls(50 + Math.round(Math.random() * 400), -60, 5, 1, -0.95);
onEnterFrame = function () {
frameNum++;
if (ballsActive == 0) {
createBalls(50 + Math.round(Math.random() * 400), 0, 5, 1, -0.95);
}
if ((((frameNum % ballInterval) == 1) && (ballsActive < 10)) && (!gameOverTest)) {
createBalls(50 + Math.round(Math.random() * 400), 0, 5, 1, -0.95);
}
if ((((frameNum % powerupInterval) == 1) && (powersActive == 0)) && (!gameOverTest)) {
createPowerUp(50 + Math.round(Math.random() * 400), 0, 5, 1, -0.95);
}
if (((frameNum % 250) == 1) && (ballInterval >= 50)) {
ballInterval = ballInterval - 5;
powerupInterval = powerupInterval + 100;
}
if ((panda.health == 0) && (gameOverTest == false)) {
gameOverPlay();
}
};
givePowerUp = function (type) {
powerUpGot = type;
var powerUpCounter = 0;
if (powerUpGot == 3) {
panda.health++;
healthBar.gotoAndStop(panda.health + 1);
}
this.createEmptyMovieClip("powerUpType", this.getNextHighestDepth());
powerUpType.onEnterFrame = function () {
powerUpCounter++;
if ((powerUpCounter == 5) && (powerUpGot == 1)) {
powerUpGot = 0;
delete this.onEnterFrame;
this.removeMovieClip();
}
if (powerUpCounter == 400) {
powerUpGot = 0;
delete this.onEnterFrame;
this.removeMovieClip();
}
};
};
gameOverPlay = function () {
gameOverTest = true;
gameOver.play();
panda.gotoAndPlay("gameOver");
};
panda.onEnterFrame = function () {
if ((this.canMove == true) && (!gameOverTest)) {
if (Key.isDown(37) && (panda._x > 50)) {
this.destx = this.destx - 5;
if (powerUpGot == 4) {
this.destx = this.destx - 5;
}
this.moving = "left";
}
if (Key.isDown(39) && (panda._x < 510)) {
this.destx = this.destx + 5;
if (powerUpGot == 4) {
this.destx = this.destx + 5;
}
this.moving = "right";
}
if ((!Key.isDown(39)) && (!Key.isDown(37))) {
this.moving = "idle";
}
var _local2 = this.destx - this._x;
this._x = this._x + (_local2 * this.moveRate);
}
};
var myListener = new Object();
myListener.onKeyDown = function () {
if ((Key.getCode() == 38) && (!creating)) {
panda.head.mouth.gotoAndPlay("blow");
bullet1._x = panda._x;
createBullet();
}
};
myListener.onKeyUp = function () {
if (Key.getCode() == 38) {
bubbleRelease = true;
}
};
Key.addListener(myListener);