Frame 1
function restartGame() {
trace("Restart game called");
_root.gotoAndPlay(1);
}
splash._visible = true;
splash.gotoAndPlay(1);
splash.logo.gotoAndPlay(1);
function splashFinished() {
trace("splash finished");
_root.gotoAndStop(2);
}
function restartGame() {
_root.blackScreen.gotoAndPlay(1);
gotoAndPlay ("restartGame");
}
stop();
com.novelgames.flashgames.common.MainDevelopment.initialize(this);
Frame 25
stop();
Symbol 33 MovieClip [EndScreen] Frame 1
function setScore(num) {
trace(num);
buttons.playAgainBTN.score.text = num;
}
background._width = Stage.width;
background._height = Stage.height;
buttons._x = Stage.width / 2;
buttons.playAgainBTN._y = (Stage.height / 2) - buttons._y;
buttons.doofLinkBTN.useHandCursor = true;
buttons.doofLinkBTN.onRelease = function () {
getURL ("http://www.doof.com", "_blank");
};
Symbol 45 MovieClip [ball] Frame 1
#initclip 14
Object.registerClass("ball", com.novelgames.flashgames.bouncing.Ball);
#endinitclip
gotoAndPlay ("special");
Instance of Symbol 41 MovieClip "wobble" in Symbol 45 MovieClip [ball] Frame 1
onClipEvent (load) {
var lastPosX = _parent._x;
var lastPosY = _parent._y;
var targetPosX = 0;
var targetPosY = 0;
var inertia = 0.7;
var xIncrement = 0;
var yIncrement = 0;
var springyness = 0.45;
}
onClipEvent (enterFrame) {
var parentSpeedX = (_parent._x - lastPosX);
var parentSpeedY = (_parent._y - lastPosY);
lastPosX = _parent._x;
lastPosY = _parent._y;
targetPosX = targetPosX - (parentSpeedX * 0.3);
targetPosY = targetPosY - (parentSpeedY * 0.3);
targetPosX = targetPosX * 0.5;
targetPosY = targetPosY * 0.5;
var xDistance = (targetPosX - _x);
var yDistance = (targetPosY - _y);
xIncrement = (xIncrement * inertia) + (xDistance * springyness);
yIncrement = (yIncrement * inertia) + (yDistance * springyness);
_x = (_x + xIncrement);
_y = (_y + yIncrement);
}
Symbol 53 MovieClip [tipsButtonMovie] Frame 1
#initclip 10
Object.registerClass("tipsButtonMovie", com.novelgames.flashgames.bouncing.TipsButtonMovie);
#endinitclip
Symbol 71 MovieClip Frame 20
stop();
var startGO = getTimer();
onEnterFrame = function () {
if ((getTimer() - startGO) > 2000) {
if (typeof(_root.sendApiScore) == "function") {
_root.sendApiScore(_parent._parent.score);
trace("sendApiScore " + _parent._parent.score);
} else {
trace("GameOverScreen");
_root.displayScore = _parent._parent.score;
_root.gotoAndPlay("GameOverScreen");
}
delete this.onEnterFrame;
}
};
Symbol 72 MovieClip [message] Frame 1
#initclip 11
Object.registerClass("message", com.novelgames.flashgames.bouncing.Message);
#endinitclip
Symbol 74 MovieClip [shootCursor] Frame 1
this._rotation = this._rotation + 5;
Symbol 92 MovieClip [game] Frame 1
#initclip 12
Object.registerClass("game", com.novelgames.flashgames.bouncing.Game);
#endinitclip
Symbol 96 MovieClip [muteButton] Frame 1
#initclip 13
Object.registerClass("muteButton", com.novelgames.flashgames.common.MuteButton);
#endinitclip
Symbol 145 MovieClip Frame 50
stop();
Symbol 146 MovieClip Frame 1
var adFinished = function () {
_visible = false;
removeMovieClip(this);
};
var mochiId = "c627ad187da2e4f8";
background._width = Stage.width;
background._height = Stage.height;
logo._x = Stage.width / 2;
logo._y = Stage.height / 2;
this.buttonMode = true;
this.useHandCursor = true;
this.onRelease = function () {
getURL ("http://www.doof.com", "_blank");
};
Symbol 146 MovieClip Frame 50
logo.stop();
var gameRes = ((Stage.width + "x") + Stage.height);
mochi.as2.MochiAd.showPreGameAd({clip:_root, id:mochiId, res:gameRes, ad_finished:adFinished});
stop();
Symbol 147 MovieClip [__Packages.com.novelgames.flashgames.common.MainDevelopment] Frame 0
class com.novelgames.flashgames.common.MainDevelopment extends MovieClip
{
var gotoAndStop, startButton, highScoresButton, moreGamesButton;
function MainDevelopment () {
super();
}
static function initialize(movieClip) {
movieClip.__proto__ = com.novelgames.flashgames.common.MainDevelopment.prototype;
movieClip.gotoTitlePage();
}
function gotoTitlePage() {
gotoAndStop("title");
startButton.onRelease = function () {
this._parent.gotoGamePage();
};
highScoresButton.onRelease = function () {
this._parent.showHighScores();
};
moreGamesButton.onRelease = function () {
this._parent.getURL("http://www.novelgames.com", "_blank");
};
}
function gotoInstructionsPage() {
gotoAndStop("instructions");
startButton.onRelease = function () {
this._parent.gotoGamePage();
};
}
function gotoGamePage() {
gotoAndStop("game");
}
function showHighScores() {
trace("showHighScores()");
}
function showEnterHighScore(score) {
trace(("showEnterHighScore(" + score) + ")");
}
}
Symbol 148 MovieClip [__Packages.mochi.as2.MochiAd] Frame 0
class mochi.as2.MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("2.5");
}
static function showPreGameAd(options) {
var _local26 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}, ad_progress:function (percent) {
}};
options = _parseOptions(options, _local26);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var _local22 = 11000;
var _local25 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local14 = _getRes(options);
var _local4 = _local14[0];
var _local13 = _local14[1];
mc._x = _local4 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local4 * -0.5;
chk._y = _local13 * -0.5;
var _local6 = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
_local6._visible = false;
delete options.no_progress_bar;
} else {
_local6._x = 10;
_local6._y = _local13 - 20;
}
var _local21 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local23 = options.outline;
delete options.outline;
var _local5 = _local6.createEmptyMovieClip("_outline", 1);
_local5.beginFill(_local19);
_local5.moveTo(0, 0);
_local5.lineTo(_local4 - 20, 0);
_local5.lineTo(_local4 - 20, 10);
_local5.lineTo(0, 10);
_local5.lineTo(0, 0);
_local5.endFill();
var _local3 = _local6.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local21);
_local3.moveTo(0, 0);
_local3.lineTo(_local4 - 20, 0);
_local3.lineTo(_local4 - 20, 10);
_local3.lineTo(0, 10);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._xscale = 0;
var _local7 = _local6.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local23, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local4 - 20, 0);
_local7.lineTo(_local4 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local22;
chk.ad_timeout = _local25;
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;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
var sendHostProgress = false;
mc.lc.sendHostLoadProgress = function (lc_name) {
sendHostProgress = true;
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local11 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local2 = (100 * _local8) / _local4;
var _local10 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local13 = Math.min(100, Math.min(_local2 || 0, _local10));
_local13 = Math.max(this.last_pcnt, _local13);
this.last_pcnt = _local13;
_local9._xscale = _local13;
options.ad_progress(_local13);
if (sendHostProgress) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local2});
if (_local2 == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var _local7 = _local11.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((_local5 > chk.ad_timeout) && (_local2 == 100)) {
options.ad_failed();
_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 showClickAwayAd(options) {
var _local9 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function () {
}, ad_finished:function () {
}, ad_loaded:function (width, height) {
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local9);
var clip = options.clip;
var _local8 = options.ad_timeout;
delete options.ad_timeout;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local4 = _getRes(options);
var _local10 = _local4[0];
var _local7 = _local4[1];
mc._x = _local10 * 0.5;
mc._y = _local7 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = _local8;
chk.started = getTimer();
chk.showing = false;
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
var _local20 = false;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
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")) {
_local2 = true;
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local2) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var _local13 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
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;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
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) {
options.ad_failed();
_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 showPreloaderAd(options) {
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
showPreGameAd(options);
}
static function showTimedAd(options) {
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
showInterLevelAd(options);
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local9 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local9._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local9.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local9._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local7 in options) {
_local4[_local7] = options[_local7];
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
mochi.as2.MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local8 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local8;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local8);
_local6.lc = _local5;
_local4.lc = _local8;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".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);
}
if (clip._mochiad._containerLCName != undefined) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
}
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++;
}
}
if (_local4.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(_local4);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
break;
case "getValue" :
var _local4 = getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod" :
var _local3 = runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local3);
break;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
base[_local2[_local1]] = value;
}
static function getValue(base, objectName) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
return(base[_local2[_local1]]);
}
static function runMethod(base, methodName, argsArray) {
var _local2 = methodName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
if (typeof(base[_local2[_local1]]) == "function") {
return(base[_local2[_local1]].apply(base, argsArray));
}
return(undefined);
}
}
Symbol 149 MovieClip [__Packages.com.novelgames.flashgames.bouncing.TipsButtonMovie] Frame 0
class com.novelgames.flashgames.bouncing.TipsButtonMovie extends MovieClip
{
var button;
function TipsButtonMovie () {
super();
button.onRelease = function () {
this._parent.getURL(com.novelgames.flashgames.bouncing.Config.TIPS_URL, "_blank");
};
}
}
Symbol 150 MovieClip [__Packages.com.novelgames.flashgames.bouncing.Config] Frame 0
class com.novelgames.flashgames.bouncing.Config
{
function Config () {
}
static var BALL_SIZE = 30;
static var BALL_HITSIZE = 25;
static var BALL_DIMENSIONX = 14;
static var BALL_INITIALROWS = 6;
static var BALL_COLOURS = [16776960, 16711680, 13311, 60951, 16711935, 10027263, 16750848];
static var BALL_SHOOTY = 345;
static var BALL_SHOOTMINANGLE = -80;
static var BALL_SHOOTMAXANGLE = 80;
static var BALL_SHOOTSPEED = 1000;
static var BALL_DROPACCELERATION = 1000;
static var BALL_GAMEOVERSPEED = 500;
static var GROUPSIZE = 3;
static var EXPLODE_DEGREES = 90;
static var EXPLODE_TIME = 200;
static var STAR_APPEARTIME = 500;
static var STAR_APPEARINTERVAL = 10;
static var LEVEL_INITIALROWS = 6;
static var LEVEL_ROWSINCREASE = 2;
static var LEVEL_INITIALTYPES = 4;
static var LEVEL_TYPESINCREASE = 0.5;
static var LEVEL_INITIALMOVESPEED = 2;
static var LEVEL_MOVESPEEDINCREASE = 0.25;
static var MESSAGE_LEVELTIME = 1000;
static var MESSAGE_WINTIME = 1000;
static var MESSAGE_GAMEOVERTIME = 1000;
static var SCORE_GROUP = 10;
static var SCORE_EXTRABALL = 5;
static var SCORE_DROP = 5;
static var SCORE_STAR = 1;
static var TIPS_URL = "/////http://www.novelgames.com/gametips/#flashGame78";
}
Symbol 151 MovieClip [__Packages.com.novelgames.flashgames.bouncing.Message] Frame 0
class com.novelgames.flashgames.bouncing.Message extends MovieClip
{
var stop, level, gotoAndStop, playAgainButton;
function Message () {
super();
stop();
}
function showLevel(level) {
this.level = level;
gotoAndStop("level");
}
function showWin() {
}
function showGameOver() {
}
function showPlayAgain() {
playAgainButton.onRelease = function () {
this._parent._parent._parent.gotoTitlePage();
};
}
function hide() {
gotoAndStop("hide");
}
}
Symbol 152 MovieClip [__Packages.com.novelgames.flashgames.bouncing.Game] Frame 0
class com.novelgames.flashgames.bouncing.Game extends MovieClip
{
var rowSpacing, score, ballsHolder, arrow, message, soundShoot, soundHit, soundGroup, soundWin, soundGameOver, onMouseMove, discLimit, _ymouse, _xmouse, shootCursor, currentLevel, noOfTypes, moveSpeed, ballInfos, startTopY, topY, lastFullRow, weight, balls, ballGeneratedRow, explodes, droppingBalls, intervalID, _parent, ballToShoot, nextBallToShoot, shootingBall, onMouseDown, startTime, lastTime, angle, explodesHolder, stars, starsHolder, attachMovie, getNextHighestDepth, _y, _x;
function Game () {
super();
rowSpacing = (com.novelgames.flashgames.bouncing.Config.BALL_SIZE * 1.73205080756888) / 2;
score = 0;
arrow._x = ballsHolder._x + ((com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX * com.novelgames.flashgames.bouncing.Config.BALL_SIZE) / 2);
arrow._y = com.novelgames.flashgames.bouncing.Config.BALL_SHOOTY;
message.__proto__ = com.novelgames.flashgames.bouncing.Message.prototype;
soundShoot = new com.novelgames.flashgames.common.NewSound(this, "soundShoot");
soundHit = new com.novelgames.flashgames.common.NewSound(this, "soundHit");
soundGroup = new com.novelgames.flashgames.common.NewSound(this, "soundGroup");
soundWin = new com.novelgames.flashgames.common.NewSound(this, "soundWin");
soundGameOver = new com.novelgames.flashgames.common.NewSound(this, "soundGameOver");
onMouseMove = mouseMoveHandler;
startLevel(1);
}
function mouseMoveHandler() {
if (Math.sqrt(Math.pow(_xmouse - arrow._x, 2) + Math.pow(_ymouse - arrow._y, 2)) > (discLimit._width / 2)) {
Mouse.show();
shootCursor._visible = false;
} else {
Mouse.hide();
shootCursor._visible = true;
shootCursor._x = _xmouse;
shootCursor._y = _ymouse;
}
}
function startLevel(level) {
var _local5 = com.novelgames.flashgames.bouncing.Config.LEVEL_INITIALROWS + ((level - 1) * com.novelgames.flashgames.bouncing.Config.LEVEL_ROWSINCREASE);
var _local4;
var _local2;
var _local3;
currentLevel = level;
noOfTypes = Math.floor(com.novelgames.flashgames.bouncing.Config.LEVEL_INITIALTYPES + ((level - 1) * com.novelgames.flashgames.bouncing.Config.LEVEL_TYPESINCREASE));
if (noOfTypes > com.novelgames.flashgames.bouncing.Config.BALL_COLOURS.length) {
noOfTypes = com.novelgames.flashgames.bouncing.Config.BALL_COLOURS.length;
}
moveSpeed = com.novelgames.flashgames.bouncing.Config.LEVEL_INITIALMOVESPEED + ((level - 1) * com.novelgames.flashgames.bouncing.Config.LEVEL_MOVESPEEDINCREASE);
ballInfos = new Array();
_local2 = 0;
while (_local2 < _local5) {
if ((_local2 % 2) == 0) {
_local4 = com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX;
} else {
_local4 = com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX - 1;
}
ballInfos[_local2] = new Array();
_local3 = 0;
while (_local3 < _local4) {
ballInfos[_local2][_local3] = Math.floor(Math.random() * noOfTypes);
_local3++;
}
_local2++;
}
startTopY = (-(_local5 - com.novelgames.flashgames.bouncing.Config.BALL_INITIALROWS)) * rowSpacing;
topY = startTopY;
lastFullRow = _local5 - 1;
weight._y = topY;
balls = new Array();
ballGeneratedRow = _local5;
_local2 = 0;
while (_local2 < explodes.length) {
explodes[_local2].removeMovieClip();
_local2++;
}
explodes = new Array();
_local2 = 0;
while (_local2 < droppingBalls.length) {
droppingBalls[_local2].removeMovieClip();
_local2++;
}
droppingBalls = new Array();
generateBalls();
message.showLevel(level);
intervalID = setInterval(this, "startPlay", com.novelgames.flashgames.bouncing.Config.MESSAGE_LEVELTIME);
}
function generateBalls() {
var _local10 = Math.floor((-topY) / rowSpacing) - 1;
var _local8;
var _local6;
var _local9;
var _local5;
var _local7;
var _local4;
var _local3;
var _local2;
if (_local10 < 0) {
_local10 = 0;
}
if (ballGeneratedRow <= _local10) {
return(undefined);
}
_local9 = (topY + ((ballGeneratedRow - 1) * rowSpacing)) + (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2);
_local3 = ballGeneratedRow - 1;
while (_local3 >= _local10) {
if ((_local3 % 2) == 0) {
_local8 = com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX;
_local6 = com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2;
} else {
_local8 = com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX - 1;
_local6 = com.novelgames.flashgames.bouncing.Config.BALL_SIZE;
}
if (!balls[_local3]) {
balls[_local3] = new Array();
}
_local2 = 0;
while (_local2 < _local8) {
if ((!balls[_local3][_local2]) && (ballInfos[_local3][_local2] != -1)) {
_local5 = ballsHolder.getNextHighestDepth();
_local7 = ballsHolder.attachMovie("ball", "ball" + _local5, _local5);
_local4 = _local7;
_local4.setType(ballInfos[_local3][_local2]);
_local4._x = _local6;
_local4._y = _local9;
balls[_local3][_local2] = _local4;
}
_local6 = _local6 + com.novelgames.flashgames.bouncing.Config.BALL_SIZE;
_local2++;
}
_local9 = _local9 - rowSpacing;
_local3--;
}
ballGeneratedRow = _local10;
}
function startPlay() {
clearInterval(intervalID);
_parent.connector.gameStarted(0);
message.hide();
generateNextBallToShoot();
ballToShoot = nextBallToShoot;
ballToShoot._y = com.novelgames.flashgames.bouncing.Config.BALL_SHOOTY;
generateNextBallToShoot();
shootingBall = null;
onMouseDown = shootBall;
startTime = getTimer();
lastTime = startTime;
intervalID = setInterval(this, "onPlayTime", 1);
}
function generateNextBallToShoot() {
var _local2 = ballsHolder.getNextHighestDepth();
var _local3 = ballsHolder.attachMovie("ball", "ball" + _local2, _local2);
nextBallToShoot = _local3;
nextBallToShoot.setType(Math.floor(Math.random() * noOfTypes));
nextBallToShoot.setSpecial();
nextBallToShoot._x = arrow._x - ballsHolder._x;
nextBallToShoot._y = arrow._y + com.novelgames.flashgames.bouncing.Config.BALL_SIZE;
}
function onPlayTime() {
var _local2 = getTimer();
var _local3 = (_local2 - lastTime) / 1000;
updateAngle();
moveBalls(_local2, true);
moveShootingBall(_local3);
moveExplodes(_local2);
moveDroppingBalls(_local2);
checkGameOver();
lastTime = _local2;
updateAfterEvent();
}
function updateAngle() {
angle = (Math.atan2(_xmouse - arrow._x, arrow._y - _ymouse) * 180) / Math.PI;
if (angle < com.novelgames.flashgames.bouncing.Config.BALL_SHOOTMINANGLE) {
angle = com.novelgames.flashgames.bouncing.Config.BALL_SHOOTMINANGLE;
} else if (angle > com.novelgames.flashgames.bouncing.Config.BALL_SHOOTMAXANGLE) {
angle = com.novelgames.flashgames.bouncing.Config.BALL_SHOOTMAXANGLE;
}
arrow._rotation = angle;
}
function moveBalls(time, shouldGenerateBalls) {
var _local4;
var _local3;
var _local2;
topY = startTopY + ((moveSpeed * (time - startTime)) / 1000);
weight._y = topY;
_local4 = (topY + ((balls.length - 1) * rowSpacing)) + (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2);
_local3 = balls.length - 1;
while (_local3 >= 0) {
if (_local4 < ((-com.novelgames.flashgames.bouncing.Config.BALL_SIZE) / 2)) {
break;
}
_local2 = 0;
while (_local2 < balls[_local3].length) {
balls[_local3][_local2]._y = _local4;
_local2++;
}
_local4 = _local4 - rowSpacing;
_local3--;
}
if (shouldGenerateBalls) {
generateBalls();
}
}
function shootBall() {
if (shootingBall) {
return(undefined);
}
if (Math.sqrt(Math.pow(_xmouse - arrow._x, 2) + Math.pow(_ymouse - arrow._y, 2)) > (discLimit._width / 2)) {
return(undefined);
}
shootingBall = ballToShoot;
shootingBall.speedX = Math.sin((angle * Math.PI) / 180) * com.novelgames.flashgames.bouncing.Config.BALL_SHOOTSPEED;
shootingBall.speedY = (-Math.cos((angle * Math.PI) / 180)) * com.novelgames.flashgames.bouncing.Config.BALL_SHOOTSPEED;
shootingBall.angle = angle;
ballToShoot = nextBallToShoot;
ballToShoot._y = com.novelgames.flashgames.bouncing.Config.BALL_SHOOTY;
generateNextBallToShoot();
soundShoot.start();
}
function moveShootingBall(seconds) {
var _local6;
var _local4;
var _local10;
var _local9;
var _local8;
var _local2;
var _local3;
var _local7;
var _local5;
if (!shootingBall) {
return(undefined);
}
_local6 = Math.floor((com.novelgames.flashgames.bouncing.Config.BALL_SHOOTSPEED * seconds) / com.novelgames.flashgames.bouncing.Config.BALL_SIZE) + 1;
_local4 = (shootingBall.speedX * seconds) / _local6;
_local10 = (shootingBall.speedY * seconds) / _local6;
_local9 = ((_local4 > 0) ? (Math.abs(shootingBall.angle)) : (-Math.abs(shootingBall.angle)));
_local7 = false;
_local8 = new flash.geom.Point(shootingBall._x, shootingBall._y);
_local2 = _local8.clone();
_local5 = 0;
while (_local5 < _local6) {
_local2.x = _local2.x + _local4;
if (_local2.x <= (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2)) {
_local2.x = com.novelgames.flashgames.bouncing.Config.BALL_SIZE - _local2.x;
_local4 = -_local4;
shootingBall.speedX = -shootingBall.speedX;
} else if (_local2.x >= ((com.novelgames.flashgames.bouncing.Config.BALL_SIZE * com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX) - (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2))) {
_local2.x = (((com.novelgames.flashgames.bouncing.Config.BALL_SIZE * com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX) * 2) - com.novelgames.flashgames.bouncing.Config.BALL_SIZE) - _local2.x;
_local4 = -_local4;
shootingBall.speedX = -shootingBall.speedX;
}
_local2.y = _local2.y + _local10;
_local3 = getStickPosition(_local8, _local2, _local9);
if ((_local3 == null) && (_local2.y <= (topY + (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2)))) {
_local3 = new flash.geom.Point(Math.floor(_local2.x / com.novelgames.flashgames.bouncing.Config.BALL_SIZE), 0);
if ((ballInfos.length > 0) && (ballInfos[0][_local3.x] != -1)) {
_local3.x++;
}
}
if (_local3) {
_local2 = getXYFromPosition(_local3);
addBallInfo(_local3.x, _local3.y, shootingBall);
_local7 = true;
break;
}
_local5++;
}
shootingBall._x = _local2.x;
shootingBall._y = _local2.y;
if (_local7) {
soundHit.start();
if (shootingBall.special) {
checkWipeout(_local3, shootingBall);
}
if (!shootingBall.special) {
checkDestroy(_local3.x, _local3.y);
}
shootingBall.removeSpecial();
shootingBall = null;
}
}
function getStickPosition(startBallPoint, ballPoint, angle) {
var _local5 = getHitPosition(ballPoint);
var _local6;
var _local4;
var _local2;
var _local3;
if (!_local5) {
return(null);
}
_local6 = getXYFromPosition(_local5);
_local4 = getStickDirections(_local6, ballPoint, angle);
_local3 = 0;
while (_local3 < _local4.length) {
_local2 = getStickPositionFromDirection(_local5, _local4[_local3]);
if (!getPositionIsValid(_local2)) {
} else if (!getPositionIsOccupied(_local2)) {
return(_local2);
}
_local3++;
}
trace("NULL!!!!");
return(null);
}
function getHitPosition(ballPoint) {
var _local4 = new flash.geom.Point(0, 0);
var _local7;
var _local6;
var _local3;
var _local2;
_local6 = Math.floor(((ballPoint.y - topY) - com.novelgames.flashgames.bouncing.Config.BALL_SIZE) / rowSpacing) - 1;
if (_local6 < 0) {
_local6 = 0;
}
_local7 = _local6 + 2;
if (_local6 >= ballInfos.length) {
_local6 = ballInfos.length - 1;
}
_local4.y = (topY + (_local7 * rowSpacing)) + (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2);
_local3 = _local7;
while (_local3 >= _local6) {
if ((_local3 % 2) == 0) {
_local4.x = com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2;
} else {
_local4.x = com.novelgames.flashgames.bouncing.Config.BALL_SIZE;
}
_local2 = 0;
while (_local2 < ballInfos[_local3].length) {
if (ballInfos[_local3][_local2] != -1) {
if (flash.geom.Point.distance(_local4, ballPoint) < com.novelgames.flashgames.bouncing.Config.BALL_HITSIZE) {
return(new flash.geom.Point(_local2, _local3));
}
}
_local4.x = _local4.x + com.novelgames.flashgames.bouncing.Config.BALL_SIZE;
_local2++;
}
_local4.y = _local4.y - rowSpacing;
_local3--;
}
return(null);
}
function getXYFromPosition(position) {
var _local4;
var _local3;
_local4 = (((position.y % 2) == 0) ? ((com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2) + (com.novelgames.flashgames.bouncing.Config.BALL_SIZE * position.x)) : (com.novelgames.flashgames.bouncing.Config.BALL_SIZE + (com.novelgames.flashgames.bouncing.Config.BALL_SIZE * position.x)));
_local3 = (topY + (position.y * rowSpacing)) + (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2);
return(new flash.geom.Point(_local4, _local3));
}
function getStickDirections(hitBallPoint, ballPoint, angle) {
var _local6 = new Array();
var _local7 = new Array();
var _local4;
var _local3;
var _local2;
var _local10;
if (angle <= -60) {
_local3 = new flash.geom.Point(1, -1);
_local4 = new flash.geom.Point(hitBallPoint.x + (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2), hitBallPoint.y - rowSpacing);
_local2 = flash.geom.Point.distance(_local4, ballPoint);
insertDistanceSortedDirection(_local6, _local7, _local3, _local2);
}
if (angle >= 60) {
_local3 = new flash.geom.Point(-1, -1);
_local4 = new flash.geom.Point(hitBallPoint.x - (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2), hitBallPoint.y - rowSpacing);
_local2 = flash.geom.Point.distance(_local4, ballPoint);
insertDistanceSortedDirection(_local6, _local7, _local3, _local2);
}
if (angle <= 0) {
_local3 = new flash.geom.Point(1, 0);
_local4 = new flash.geom.Point(hitBallPoint.x + com.novelgames.flashgames.bouncing.Config.BALL_SIZE, hitBallPoint.y);
_local2 = flash.geom.Point.distance(_local4, ballPoint);
insertDistanceSortedDirection(_local6, _local7, _local3, _local2);
}
if (angle >= 0) {
_local3 = new flash.geom.Point(-1, 0);
_local4 = new flash.geom.Point(hitBallPoint.x - com.novelgames.flashgames.bouncing.Config.BALL_SIZE, hitBallPoint.y);
_local2 = flash.geom.Point.distance(_local4, ballPoint);
insertDistanceSortedDirection(_local6, _local7, _local3, _local2);
}
if (angle <= 60) {
_local3 = new flash.geom.Point(1, 1);
_local4 = new flash.geom.Point(hitBallPoint.x + (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2), hitBallPoint.y + rowSpacing);
_local2 = flash.geom.Point.distance(_local4, ballPoint);
insertDistanceSortedDirection(_local6, _local7, _local3, _local2);
}
if (angle >= -60) {
_local3 = new flash.geom.Point(-1, 1);
_local4 = new flash.geom.Point(hitBallPoint.x - (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2), hitBallPoint.y + rowSpacing);
_local2 = flash.geom.Point.distance(_local4, ballPoint);
insertDistanceSortedDirection(_local6, _local7, _local3, _local2);
}
return(_local6);
}
function insertDistanceSortedDirection(directions, distances, direction, distance) {
var _local1;
_local1 = 0;
while (_local1 < distances.length) {
if (distance < distances[_local1]) {
break;
}
_local1++;
}
directions.splice(_local1, 0, direction);
distances.splice(_local1, 0, distance);
}
function getStickPositionFromDirection(hitPosition, stickDirection) {
var _local3;
var _local4;
_local4 = hitPosition.y + stickDirection.y;
if (stickDirection.y == 0) {
_local3 = hitPosition.x + stickDirection.x;
} else if ((hitPosition.y % 2) == 0) {
_local3 = ((stickDirection.x == -1) ? (hitPosition.x - 1) : (hitPosition.x));
} else {
_local3 = ((stickDirection.x == -1) ? (hitPosition.x) : (hitPosition.x + 1));
}
return(new flash.geom.Point(_local3, _local4));
}
function getPositionIsValid(position) {
if (position.y < 0) {
return(false);
}
if (position.x < 0) {
return(false);
}
if ((position.y % 2) == 0) {
if (position.x >= com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX) {
return(false);
}
} else if (position.x >= (com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX - 1)) {
return(false);
}
return(true);
}
function getPositionIsOccupied(position) {
return((ballInfos[position.y][position.x] != undefined) && (ballInfos[position.y][position.x] != -1));
}
function addBallInfo(x, y, ball) {
var _local4;
var _local2;
if (!ballInfos[y]) {
ballInfos[y] = new Array();
_local4 = (((y % 2) == 0) ? (com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX) : (com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX - 1));
_local2 = 0;
while (_local2 < _local4) {
ballInfos[y][_local2] = -1;
_local2++;
}
}
if (!balls[y]) {
balls[y] = new Array();
_local4 = (((y % 2) == 0) ? (com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX) : (com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX - 1));
_local2 = 0;
while (_local2 < _local4) {
balls[y][_local2] = null;
_local2++;
}
}
ballInfos[y][x] = ball.type;
balls[y][x] = ball;
}
function checkWipeout(shootingPoint, shootingBall) {
var _local9 = getGroupPoints(shootingPoint.x, shootingPoint.y);
trace(_local9.length + " matches scored.");
if (_local9.length >= com.novelgames.flashgames.bouncing.Config.GROUPSIZE) {
var _local6 = Number.MAX_VALUE;
var _local2 = 0;
while (_local2 < balls.length) {
var _local7 = balls[_local2];
var _local3 = 0;
while (_local3 < _local7.length) {
var _local5;
var _local4;
if (balls[_local2][_local3] && (balls[_local2][_local3].type == shootingBall.type)) {
_local5 = explodesHolder.getNextHighestDepth();
_local4 = explodesHolder.attachMovie("explode", "explode" + _local5, _local5);
if (_local2 < _local6) {
_local6 = _local2;
}
_local4._x = balls[_local2][_local3]._x;
_local4._y = balls[_local2][_local3]._y;
_local4.startTime = getTimer();
explodes.push(_local4);
balls[_local2][_local3].removeMovieClip();
balls[_local2][_local3] = null;
ballInfos[_local2][_local3] = -1;
}
_local3++;
}
_local2++;
}
if (_local6 <= lastFullRow) {
lastFullRow = _local6 - 2;
}
checkDrop();
_local2 = ballInfos.length - 1;
while (_local2 >= 0) {
var _local3 = 0;
while (_local3 < ballInfos[_local2].length) {
if (ballInfos[_local2][_local3] != -1) {
break;
}
_local3++;
}
if (_local3 >= ballInfos[_local2].length) {
balls.splice(_local2, 1);
ballInfos.splice(_local2, 1);
}
_local2--;
}
checkWin();
}
}
function checkDestroy(x, y) {
var _local7 = getGroupPoints(x, y);
var _local10;
var _local8;
var _local6;
var _local9 = Number.MAX_VALUE;
var _local2;
var _local3;
if (_local7.length < com.novelgames.flashgames.bouncing.Config.GROUPSIZE) {
return(undefined);
}
_local10 = com.novelgames.flashgames.bouncing.Config.SCORE_GROUP + ((_local7.length - com.novelgames.flashgames.bouncing.Config.GROUPSIZE) * com.novelgames.flashgames.bouncing.Config.SCORE_EXTRABALL);
score = score + _local10;
_local2 = 0;
while (_local2 < _local7.length) {
x = _local7[_local2].x;
y = _local7[_local2].y;
if (balls[y][x]) {
_local8 = explodesHolder.getNextHighestDepth();
_local6 = explodesHolder.attachMovie("explode", "explode" + _local8, _local8);
_local6._x = balls[y][x]._x;
_local6._y = balls[y][x]._y;
_local6.startTime = getTimer();
explodes.push(_local6);
balls[y][x].removeMovieClip();
balls[y][x] = null;
}
ballInfos[y][x] = -1;
if (y < _local9) {
_local9 = y;
}
_local2++;
}
if (_local9 <= lastFullRow) {
lastFullRow = _local9 - 1;
}
checkDrop();
_local2 = ballInfos.length - 1;
while (_local2 >= 0) {
_local3 = 0;
while (_local3 < ballInfos[_local2].length) {
if (ballInfos[_local2][_local3] != -1) {
break;
}
_local3++;
}
if (_local3 >= ballInfos[_local2].length) {
balls.splice(_local2, 1);
ballInfos.splice(_local2, 1);
}
_local2--;
}
soundGroup.start();
checkWin();
}
function getGroupPoints(x, y) {
var _local5 = ballInfos[y][x];
var _local4 = new Array();
var _local6;
_local4.push(new flash.geom.Point(x, y));
_local6 = 0;
while (_local6 < _local4.length) {
x = _local4[_local6].x;
y = _local4[_local6].y;
if ((x > 0) && (ballInfos[y][x - 1] == _local5)) {
addNonDuplicatePoint(_local4, new flash.geom.Point(x - 1, y));
}
if ((x < (ballInfos[y].length - 1)) && (ballInfos[y][x + 1] == _local5)) {
addNonDuplicatePoint(_local4, new flash.geom.Point(x + 1, y));
}
if ((y % 2) == 0) {
if (y > 0) {
if ((x > 0) && (ballInfos[y - 1][x - 1] == _local5)) {
addNonDuplicatePoint(_local4, new flash.geom.Point(x - 1, y - 1));
}
if ((x < (com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX - 1)) && (ballInfos[y - 1][x] == _local5)) {
addNonDuplicatePoint(_local4, new flash.geom.Point(x, y - 1));
}
}
if (y < (ballInfos.length - 1)) {
if ((x > 0) && (ballInfos[y + 1][x - 1] == _local5)) {
addNonDuplicatePoint(_local4, new flash.geom.Point(x - 1, y + 1));
}
if ((x < (com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX - 1)) && (ballInfos[y + 1][x] == _local5)) {
addNonDuplicatePoint(_local4, new flash.geom.Point(x, y + 1));
}
}
} else {
if (ballInfos[y - 1][x] == _local5) {
addNonDuplicatePoint(_local4, new flash.geom.Point(x, y - 1));
}
if (ballInfos[y - 1][x + 1] == _local5) {
addNonDuplicatePoint(_local4, new flash.geom.Point(x + 1, y - 1));
}
if (y < (ballInfos.length - 1)) {
if (ballInfos[y + 1][x] == _local5) {
addNonDuplicatePoint(_local4, new flash.geom.Point(x, y + 1));
}
if (ballInfos[y + 1][x + 1] == _local5) {
addNonDuplicatePoint(_local4, new flash.geom.Point(x + 1, y + 1));
}
}
}
_local6++;
}
return(_local4);
}
function addNonDuplicatePoint(points, point) {
var _local1;
_local1 = 0;
while (_local1 < points.length) {
if ((points[_local1].x == point.x) && (points[_local1].y == point.y)) {
return(undefined);
}
_local1++;
}
points.push(point);
}
function checkDrop() {
var _local6 = new Array();
var _local10 = new Array();
var _local13;
var _local14 = new Array();
var _local15;
var _local11;
var _local4;
var _local3;
var _local9;
var _local12;
var _local7;
var _local8;
var _local2;
var _local5;
_local2 = 0;
while (_local2 < ballInfos[lastFullRow + 1].length) {
if (ballInfos[lastFullRow + 1][_local2] == -1) {
} else {
_local6.push(new flash.geom.Point(_local2, lastFullRow + 1));
}
_local2++;
}
_local2 = 0;
while (_local2 < _local6.length) {
_local4 = _local6[_local2].x;
_local3 = _local6[_local2].y;
if ((_local4 > 0) && (ballInfos[_local3][_local4 - 1] != -1)) {
addNonDuplicatePoint(_local6, new flash.geom.Point(_local4 - 1, _local3));
}
if ((_local4 < (ballInfos[_local3].length - 1)) && (ballInfos[_local3][_local4 + 1] != -1)) {
addNonDuplicatePoint(_local6, new flash.geom.Point(_local4 + 1, _local3));
}
if ((_local3 % 2) == 0) {
if (_local3 > (lastFullRow + 1)) {
if ((_local4 > 0) && (ballInfos[_local3 - 1][_local4 - 1] != -1)) {
addNonDuplicatePoint(_local6, new flash.geom.Point(_local4 - 1, _local3 - 1));
}
if ((_local4 < (com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX - 1)) && (ballInfos[_local3 - 1][_local4] != -1)) {
addNonDuplicatePoint(_local6, new flash.geom.Point(_local4, _local3 - 1));
}
}
if (_local3 < (ballInfos.length - 1)) {
if ((_local4 > 0) && (ballInfos[_local3 + 1][_local4 - 1] != -1)) {
addNonDuplicatePoint(_local6, new flash.geom.Point(_local4 - 1, _local3 + 1));
}
if ((_local4 < (com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX - 1)) && (ballInfos[_local3 + 1][_local4] != -1)) {
addNonDuplicatePoint(_local6, new flash.geom.Point(_local4, _local3 + 1));
}
}
} else {
if (_local3 > (lastFullRow + 1)) {
if (ballInfos[_local3 - 1][_local4] != -1) {
addNonDuplicatePoint(_local6, new flash.geom.Point(_local4, _local3 - 1));
}
if (ballInfos[_local3 - 1][_local4 + 1] != -1) {
addNonDuplicatePoint(_local6, new flash.geom.Point(_local4 + 1, _local3 - 1));
}
}
if (_local3 < (ballInfos.length - 1)) {
if (ballInfos[_local3 + 1][_local4] != -1) {
addNonDuplicatePoint(_local6, new flash.geom.Point(_local4, _local3 + 1));
}
if (ballInfos[_local3 + 1][_local4 + 1] != -1) {
addNonDuplicatePoint(_local6, new flash.geom.Point(_local4 + 1, _local3 + 1));
}
}
}
_local2++;
}
_local2 = lastFullRow + 1;
while (_local2 < ballInfos.length) {
_local10[_local2] = new Array();
_local2++;
}
_local2 = 0;
while (_local2 < _local6.length) {
_local10[_local6[_local2].y][_local6[_local2].x] = true;
_local2++;
}
_local13 = 0;
_local11 = getTimer();
_local2 = lastFullRow + 1;
while (_local2 < ballInfos.length) {
_local5 = 0;
while (_local5 < ballInfos[_local2].length) {
if (ballInfos[_local2][_local5] == -1) {
} else if (_local10[_local2][_local5]) {
} else {
if (balls[_local2][_local5]) {
balls[_local2][_local5].startTime = _local11;
balls[_local2][_local5].startY = balls[_local2][_local5]._y;
droppingBalls.push(balls[_local2][_local5]);
} else {
_local9 = ballsHolder.getNextHighestDepth();
_local12 = ballsHolder.attachMovie("ball", "ball" + _local9, _local9);
_local7 = _local12;
_local8 = getXYFromPosition(new flash.geom.Point(_local5, _local2));
_local7.setType(ballInfos[_local2][_local5]);
_local7._x = _local8.x;
_local7._y = _local8.y;
_local7.startTime = _local11;
_local7.startY = _local8.y;
droppingBalls.push(_local7);
}
ballInfos[_local2][_local5] = -1;
_local13++;
}
_local5++;
}
_local2++;
}
_local15 = _local14.length * com.novelgames.flashgames.bouncing.Config.SCORE_DROP;
score = score + _local15;
}
function moveExplodes(time) {
var _local3;
var _local2;
_local2 = 0;
while (_local2 < explodes.length) {
_local3 = (time - explodes[_local2].startTime) / com.novelgames.flashgames.bouncing.Config.EXPLODE_TIME;
if (_local3 >= 1) {
explodes[_local2].removeMovieClip();
explodes.splice(_local2, 1);
_local2--;
} else {
explodes[_local2]._alpha = 100 - (_local3 * 100);
}
_local2++;
}
}
function moveDroppingBalls(time) {
var _local3;
var _local2;
_local2 = 0;
while (_local2 < droppingBalls.length) {
_local3 = (time - droppingBalls[_local2].startTime) / 1000;
droppingBalls[_local2]._y = droppingBalls[_local2].startY + (((com.novelgames.flashgames.bouncing.Config.BALL_DROPACCELERATION * _local3) * _local3) / 2);
if (droppingBalls[_local2]._y > (Stage.height + (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2))) {
droppingBalls[_local2].removeMovieClip();
droppingBalls.splice(_local2, 1);
_local2--;
}
_local2++;
}
}
function checkWin() {
var _local6;
var _local5;
var _local3;
var _local4;
var _local2;
if (ballInfos.length > 0) {
return(undefined);
}
onMouseDown = null;
ballToShoot.removeMovieClip();
nextBallToShoot.removeMovieClip();
_local6 = Math.floor((com.novelgames.flashgames.bouncing.Config.BALL_SHOOTY - topY) / com.novelgames.flashgames.bouncing.Config.BALL_SIZE);
if (_local6 <= 0) {
_local6 = 1;
}
stars = new Array();
_local4 = 0;
while (_local4 < _local6) {
_local2 = 0;
while (_local2 < com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX) {
_local5 = starsHolder.getNextHighestDepth();
_local3 = starsHolder.attachMovie("star", "star" + _local5, _local5);
_local3._x = (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2) + (_local2 * com.novelgames.flashgames.bouncing.Config.BALL_SIZE);
_local3._y = (com.novelgames.flashgames.bouncing.Config.BALL_SHOOTY - (com.novelgames.flashgames.bouncing.Config.BALL_SIZE / 2)) - (_local4 * com.novelgames.flashgames.bouncing.Config.BALL_SIZE);
_local3._visible = false;
stars[(_local4 * com.novelgames.flashgames.bouncing.Config.BALL_DIMENSIONX) + _local2] = _local3;
_local2++;
}
_local4++;
}
message.showWin();
soundWin.start();
clearInterval(intervalID);
startTime = getTimer();
lastTime = startTime;
intervalID = setInterval(this, "onWinTime", 1);
}
function onWinTime() {
var _local4 = getTimer();
var _local3;
var _local2;
moveExplodes(_local4);
moveDroppingBalls(_local4);
_local2 = 0;
while (_local2 < stars.length) {
_local3 = (_local4 - startTime) - (_local2 * com.novelgames.flashgames.bouncing.Config.STAR_APPEARINTERVAL);
if ((_local3 <= 0) || (_local3 >= com.novelgames.flashgames.bouncing.Config.STAR_APPEARTIME)) {
stars[_local2]._visible = false;
} else {
if (((lastTime - startTime) - (_local2 * com.novelgames.flashgames.bouncing.Config.STAR_APPEARINTERVAL)) <= 0) {
stars[_local2]._visible = true;
score = score + com.novelgames.flashgames.bouncing.Config.SCORE_STAR;
}
stars[_local2]._alpha = (1 - (_local3 / com.novelgames.flashgames.bouncing.Config.STAR_APPEARTIME)) * 100;
}
_local2++;
}
if (_local3 >= com.novelgames.flashgames.bouncing.Config.STAR_APPEARTIME) {
_local2 = 0;
while (_local2 < stars.length) {
stars[_local2].removeMovieClip();
_local2++;
}
clearInterval(intervalID);
intervalID = setInterval(this, "startNextLevel", com.novelgames.flashgames.bouncing.Config.MESSAGE_WINTIME);
}
lastTime = _local4;
updateAfterEvent();
}
function startNextLevel() {
clearInterval(intervalID);
startLevel(currentLevel + 1);
}
function checkGameOver() {
var _local5;
if (((topY + ((ballInfos.length - 1) * rowSpacing)) + com.novelgames.flashgames.bouncing.Config.BALL_SIZE) <= com.novelgames.flashgames.bouncing.Config.BALL_SHOOTY) {
return(undefined);
}
var doofEndScreen = attachMovie("EndScreen", "doofEndScreen", getNextHighestDepth(), {_x:-_x, _y:-_y});
_root.displayScore = score;
doofEndScreen.buttons.playAgainBTN.score.text = _root.displayScore;
doofEndScreen.buttons.playAgainBTN.useHandCursor = true;
doofEndScreen.buttons.playAgainBTN.onRelease = function () {
doofEndScreen.visible = false;
this.removeMovieClip();
_root.gotoAndPlay(1);
};
Mouse.show();
trace("GAME OVER");
onMouseDown = null;
ballToShoot.removeMovieClip();
nextBallToShoot.removeMovieClip();
shootingBall.removeMovieClip();
message.showGameOver();
startTopY = topY;
moveSpeed = com.novelgames.flashgames.bouncing.Config.BALL_GAMEOVERSPEED;
soundGameOver.start();
clearInterval(intervalID);
startTime = getTimer();
lastTime = startTime;
intervalID = setInterval(this, "onGameOverTime", 1);
}
function onGameOverTime() {
var _local2 = getTimer();
var _local3 = false;
if ((((_local2 - startTime) * com.novelgames.flashgames.bouncing.Config.BALL_GAMEOVERSPEED) / 1000) >= ((com.novelgames.flashgames.bouncing.Config.BALL_SHOOTY - startTopY) - (ballGeneratedRow * rowSpacing))) {
_local2 = startTime + ((((com.novelgames.flashgames.bouncing.Config.BALL_SHOOTY - startTopY) - (ballGeneratedRow * rowSpacing)) * 1000) / com.novelgames.flashgames.bouncing.Config.BALL_GAMEOVERSPEED);
_local3 = true;
}
moveBalls(_local2, false);
weight._y = topY + (ballGeneratedRow * rowSpacing);
moveExplodes(_local2);
moveDroppingBalls(_local2);
lastTime = _local2;
if (_local3) {
clearInterval(intervalID);
intervalID = setInterval(this, "showPlayAgain", com.novelgames.flashgames.bouncing.Config.MESSAGE_GAMEOVERTIME);
}
updateAfterEvent();
}
function showPlayAgain() {
clearInterval(intervalID);
message.showPlayAgain();
_parent.showEnterHighScore(score);
}
var fallingBalls = new Array();
}
Symbol 153 MovieClip [__Packages.com.novelgames.flashgames.bouncing.Ball] Frame 0
class com.novelgames.flashgames.bouncing.Ball extends MovieClip
{
var cacheAsBitmap, special, type, colour, flash, _name;
function Ball () {
super();
cacheAsBitmap = true;
special = false;
}
function setType(type) {
this.type = type;
new Color(colour).setRGB(com.novelgames.flashgames.bouncing.Config.BALL_COLOURS[type]);
}
function setSpecial() {
removeSpecial();
if ((Math.random() * 100) > 180) {
trace("SPECIAL CREATED");
special = true;
flash._alpha = 50;
trace(_name);
}
}
function removeSpecial() {
flash._alpha = 0;
special = false;
}
}
Symbol 154 MovieClip [__Packages.com.novelgames.flashgames.common.NewSound] Frame 0
class com.novelgames.flashgames.common.NewSound extends Sound
{
var attachSound, setVolume, target, symbolName;
function NewSound (target, symbolName) {
super(target);
var _local3;
attachSound(symbolName);
setVolume(volumeAll);
this.target = target;
this.symbolName = symbolName;
sounds.push(this);
_local3 = 0;
while (_local3 < sounds.length) {
if (sounds[_local3] == this) {
} else if ((sounds[_local3].target == target) && (sounds[_local3].symbolName == symbolName)) {
sounds.splice(_local3, 1);
_local3--;
}
_local3++;
}
}
static function setVolumeAll(volume) {
var _local1;
volumeAll = volume;
_local1 = 0;
while (_local1 < sounds.length) {
sounds[_local1].setVolume(volume);
_local1++;
}
}
static function muteAll() {
setVolumeAll(0);
}
static function unmuteAll() {
setVolumeAll(100);
}
static function getIsMuteAll() {
return(volumeAll == 0);
}
static var sounds = new Array();
static var volumeAll = 100;
}
Symbol 155 MovieClip [__Packages.com.novelgames.flashgames.common.MuteButton] Frame 0
class com.novelgames.flashgames.common.MuteButton extends MovieClip
{
var gotoAndStop;
function MuteButton () {
super();
if (com.novelgames.flashgames.common.NewSound.getIsMuteAll()) {
showOff();
} else {
showOn();
}
}
function onPress() {
if (com.novelgames.flashgames.common.NewSound.getIsMuteAll()) {
com.novelgames.flashgames.common.NewSound.unmuteAll();
showOn();
} else {
com.novelgames.flashgames.common.NewSound.muteAll();
showOff();
}
}
function showOff() {
gotoAndStop("off");
}
function showOn() {
gotoAndStop("on");
}
}