Frame 1
var bubbles = 40;
var width = 600;
var height = 450;
var stopped = true;
var seed = new Date();
var IDsep = ":";
var gameID = ((((((((((seed.getFullYear() + IDsep) + seed.getMonth()) + IDsep) + seed.getDate()) + IDsep) + seed.getHours()) + IDsep) + seed.getMinutes()) + IDsep) + seed.getSeconds());
var buttonText = "<< START PLAYING BUBBLES >>";
var scoreText = "<< VIEW HIGH SCORES >>";
var pauseRate = 0;
Instance of Symbol 10 MovieClip "bubblebase" in Frame 1
onClipEvent (load) {
function bubbleStart(target) {
var scale = (random(150) + 75);
setProperty(target, _xscale , scale);
setProperty(target, _yscale , scale);
setProperty(target, _x , random(_root.width));
setProperty(target, _y , _root.height - random(_root.height));
}
this._visible = false;
i = 0;
while (i < _root.bubbles) {
attachMovie("bubble", "b" + i, i);
bubbleStart("b" + i);
i++;
}
pop = new Sound();
pop.attachSound("pop");
}
onClipEvent (enterFrame) {
if (!_root.stopped) {
this._visible = true;
i = 0;
while (i < _root.bubbles) {
var target = eval ("b" + i);
var y = getProperty(target, _y);
if (0 < y) {
var yInc = ((target._xscale / 100) + 1);
setProperty(target, _y , y - yInc);
} else {
if (target._currentframe >= 9) {
_root.popped--;
}
target.gotoAndPlay(1);
setProperty(target, _x , random(_root.width));
setProperty(target, _y , _root.height);
}
if (target.hitTest(_root._xmouse, _root._ymouse, true) && (target._currentFrame < 9)) {
target.gotoAndPlay(9);
pop.start();
_root.popped++;
_root.total++;
if (_root.max < _root.popped) {
_root.max = _root.popped;
}
}
i++;
}
} else {
this._visible = false;
}
}
Instance of Symbol 14 MovieClip "bubbleometer" in Frame 1
onClipEvent (load) {
var i = 0;
while (i < _root.bubbles) {
attachMovie("staticBubble", "bo" + i, i);
var target = eval ("bo" + i);
setProperty(target, _x , i * 12);
setProperty(target, _visible , false);
setProperty(target, _alpha , 50);
i++;
}
}
onClipEvent (enterFrame) {
var i = 0;
while (i < _root.max) {
var target = ("bo" + i);
setProperty(target, _visible , true);
setProperty(target, _alpha , 50);
i++;
}
var i = 0;
while (i < _root.popped) {
var target = ("bo" + i);
setProperty(target, _alpha , 100);
i++;
}
}
onClipEvent (keyDown) {
if (Key.getCode() == 32) {
if (_root.stopped) {
_root.stopped = false;
_root.totalPause = _root.totalPause + _root.pauseLength;
} else {
_root.loadVariables("lowscore.txt");
if (_root.lowscore < _root.score) {
_root.scoreText = "<< SUBMIT HIGH SCORE >>";
}
_root.stopped = true;
_root.paused++;
_root.pauseStart = getTimer();
}
}
}
Instance of Symbol 16 MovieClip in Frame 1
onClipEvent (enterFrame) {
if ((_root.timeOut < 10) && (_root.stopped == false)) {
this._visible = true;
} else {
this._visible = false;
}
}
Instance of Symbol 42 MovieClip in Frame 1
onClipEvent (enterFrame) {
function getPoprate() {
_root.pauseLength = getTimer() - _root.pauseStart;
_root.timeOut = Math.round((getTimer() - (_root.pauseLength + _root.totalPause)) / 1000);
if (0 < _root.timeOut) {
var poprate = Math.round((_root.total / _root.timeOut) * 100);
var pop100 = parseInt(poprate / 100);
var pop10 = parseInt((poprate % 100) / 10);
var pop1 = (poprate % 10);
_root.poprate = (((pop100 + ".") + pop10) + pop1) + "/sec";
var minutes = parseInt(_root.timeOut / 60);
if (9 < (_root.timeOut % 60)) {
var seconds = (_root.timeOut % 60);
} else {
var seconds = ("0" + (_root.timeOut % 60));
}
_root.timeString = (minutes + ":") + seconds;
}
_root.score = Math.round(((poprate / 100) * _root.total) * _root.max);
}
if (_root.stopped) {
this._visible = true;
getPoprate();
if ((10 < _root.timeOut) && (_root.pauseRate < (_root.paused / _root.timeOut))) {
_root.pauseRate = _root.paused / _root.timeOut;
}
} else {
this._visible = false;
}
}
Symbol 7 MovieClip [bubble] Frame 8
gotoAndPlay (1);
Symbol 7 MovieClip [bubble] Frame 14
stop();
Symbol 35 Button
on (release) {
_root.stopped = false;
_root.buttonText = "<< CONTINUE PLAYING BUBBLES >>";
_root.totalPause = _root.totalPause + _root.pauseLength;
}
Symbol 38 Button
on (release) {
if (_root.pauseRate < 0.1) {
var argString = ((((((((((_root.score + ",") + parseFloat(_root.popRate)) + ",") + _root.max) + ",") + _root.total) + ",") + _root.timeOut) + ",") + _root.gameID);
getURL (("javascript:setCookie('" + argString) + "')");
} else {
var argString = ("0,0,0,0,0," + _root.gameID);
getURL (("javascript:setCookie('" + argString) + "')");
}
}
Symbol 41 Button
on (release) {
getURL ("mailto:?subject=Bubbles&body=Play%20Bubbles%20at%20http://tomandphil.myby.co.uk/bubbles/");
}