Frame 1
function inits() {
statsTracker = new LoadVars();
statsTracker.load("pumpkinblast-load.html");
_global.myRoot = this;
firstTime = true;
defaultValues = new Object({ratReleaseRate:1000, ratWalkDistance:10, pointsRate:85, maxLevel:5, growthRate1:166, newRate1:750, growthRate2:83, newRate2:750, growthRate3:83, newRate3:400, growthRate4:41, newRate4:200, growthRate5:41, newRate5:41, level1EndTime:20000, level2EndTime:30000, level3EndTime:40000, level4EndTime:20000, explosionRate:85});
}
inits();
loadValues();
Frame 3
if (getBytesTotal() == getBytesLoaded()) {
myRoot.gotoAndStop("loaded");
} else {
gotoAndStop (4);
}
Frame 8
function oneTimeInits() {
var temp = meter.getBounds(myRoot);
leftBoundary = temp.xMin;
rightBoundary = temp.xMax;
musicOnOff = "music on";
rowsList = new Array();
var _local1 = 0;
while (_local1 <= 6) {
rowsList[_local1] = {w:myRoot["row" + _local1]._width, scale:myRoot["row" + _local1]._xscale, y:myRoot["row" + _local1]._y, tm:Math.round((rightBoundary - leftBoundary) / myRoot["row" + _local1]._width)};
_local1++;
}
}
function startGame() {
musicOnOffField._visible = true;
musicOnOffButton._visible = true;
statsTracker.load("pumpkinblast-play.html");
keyListener = new Object();
keyListener.onKeyDown = function () {
if ((Key.isDown(16) && (Key.isDown(73))) && (Key.isDown(78))) {
trace("yes");
myRoot.info.showMe();
} else if (Key.getCode() == 32) {
trace("super zapper!");
playTheSound("superPicker");
myRoot.rat.collect(false);
var _local1 = new Array();
for (temp in myRoot) {
if (temp.substr(0, 7) == "pumpkin") {
_local1.push(myRoot[temp]);
}
}
cnt = 0;
while (cnt < _local1.length) {
_local1[cnt].collect(false);
cnt++;
}
Key.removeListener(keyListener);
}
};
Key.addListener(keyListener);
introScreen.hideMe();
gameOverScreen.hideMe();
if (firstTime == true) {
gotoAndStop ("play");
oneTimeInits();
}
firstTime = false;
trace("start:" + musicOnOff);
if (musicOnOff == "music on") {
playTheSound("bgMusic", 9999, true);
}
scoreBoard.reset();
meter.init();
pointsDepth = 0;
pLevel = 2;
showPoints._visible = false;
rat.init();
locations = new Array();
levelBeginTime = (newRateTimer = getTimer());
level = 1;
newRate = Number(defaultValues["newRate" + level]);
growthRate = Number(defaultValues["growthRate" + level]);
maxLevel = Number(defaultValues.maxLevel);
levelEndTime = Number(defaultValues[("level" + level) + "EndTime"]);
onEnterFrame = mainTimer;
}
function mainTimer() {
t = getTimer();
if ((newRateTimer + newRate) < t) {
newRateTimer = getTimer();
var _local1 = "pumpkin" + (++pLevel);
if (randomInt(1, 2) == 1) {
duplicateMovieClip ("row5", _local1, pLevel);
} else {
duplicateMovieClip ("row6", _local1, pLevel);
}
myRoot[_local1]._visible = false;
}
if ((level < maxLevel) && ((levelBeginTime + levelEndTime) < t)) {
level++;
levelEndTime = Number(defaultValues[("level" + level) + "EndTime"]);
newRate = Number(defaultValues["newRate" + level]);
growthRate = Number(defaultValues["growthRate" + level]);
levelBeginTime = getTimer();
}
}
function showHelp() {
gotoAndStop ("help");
}
function gameOver() {
var _local2 = this;
trace("game over");
musicOnOffField._visible = false;
musicOnOffButton._visible = false;
stopTheSound("bgMusic", true);
delete onEnterFrame;
Key.removeListener(keyListener);
meter.pauseMe();
rat.hideMe();
gameOverScreen.playMe();
var _local1 = new Array();
for (temp in _local2) {
if (temp.substr(0, 7) == "pumpkin") {
_local1.push(_local2[temp]);
}
}
cnt = 0;
while (cnt < _local1.length) {
_local1[cnt].explodeMe(false);
cnt++;
}
myRoot.playTheSound("explosion");
}
function showThePoints(howMuch, x, y, s) {
attachMovie("showPoints", "showPoints" + (++myRoot.pointsDepth), 900000 + myRoot.pointsDepth, {_x:x, _y:y, myValue:howMuch, _xscale:s, _yscale:s});
}
function stopTheSound(what, fade) {
var _local1 = what;
if (fade == true) {
myRoot["fade" + _local1].snd.stop();
myRoot["fade" + _local1].removeMovieClip();
} else {
myRoot["sound" + _local1].stop();
}
}
function playTheSound(what, c, fade) {
var _local1 = what;
var _local2 = this;
if (fade == true) {
myRoot["sound" + _local1].setVolume(0);
myRoot.createEmptyMovieClip("fade" + _local1, 1);
myRoot["fade" + _local1].snd = new Sound(myRoot["fade" + _local1]);
myRoot["fade" + _local1].snd.attachSound(_local1);
myRoot["fade" + _local1].snd.start(0, c);
myRoot["fade" + _local1].snd.setVolume(0);
myRoot["fade" + _local1].t1 = getTimer();
myRoot["fade" + _local1].t2 = 2000;
myRoot["fade" + _local1].onEnterFrame = function () {
var _local1 = this;
var _local2 = _local1.snd.getVolume();
var _local3 = Math.round(((getTimer() - _local1.t1) / _local1.t2) * 100);
if (_local2 >= 100) {
_local1.snd.setVolume(100);
delete _local1.onEnterFrame;
} else {
_local1.snd.setVolume(_local3);
}
};
} else {
myRoot["sound" + _local1] = new Sound(_local2);
myRoot["sound" + _local1].attachSound(_local1);
myRoot["sound" + _local1].start(0, c);
}
}
MovieClip.prototype.randomInt = function (minNum, maxNum) {
return(Math.round(Math.random() * (maxNum - minNum)) + minNum);
};
String.prototype.trim = function () {
var _local1 = this;
l = 0;
while ((l < _local1.length) && (_local1.charAt(l) == " ")) {
l++;
}
r = _local1.length;
while ((r > 0) && (_local1.charAt(r - 1) == " ")) {
r--;
}
return(_local1.substring(l, r));
};
Symbol 3 MovieClip Frame 8
stop();
Symbol 17 MovieClip Frame 1
function preload() {
theText.gotoAndStop(2);
myFrameRate = 12;
myFrameTime = 1000 / myFrameRate;
s = (t = getTimer());
this.onEnterFrame = function () {
if ((t + myFrameTime) < getTimer()) {
t = getTimer();
inside._width = (myRoot.getBytesLoaded() / myRoot.getBytesTotal()) * (maxWidth + 10);
if ((myRoot.getBytesTotal() == myRoot.getBytesLoaded()) && ((s + 1000) < getTimer())) {
myRoot.gotoAndStop("loaded");
delete this.onEnterFrame;
}
}
};
}
function init() {
trace("meter:init");
gotoAndStop (2);
theText.gotoAndStop(1);
gameOver = false;
inside._width = 0;
reduceTime = 500;
lastTime = getTimer();
onEnterFrame = mainTimer;
}
function mainTimer() {
t = getTimer();
if ((lastTime + reduceTime) < t) {
inside._width = inside._width - 1;
if (inside._width < 0) {
inside._width = 0;
}
lastTime = getTimer();
}
}
function bumpUp() {
trace("meter:bumpup");
if (gameOver == true) {
return(undefined);
}
inside._width = inside._width + 50;
if (inside._width > maxWidth) {
gameOver = true;
playFinish();
}
}
function pauseMe() {
trace("meter:pauseMe");
gameOver = true;
inside._width = 0;
delete onEnterFrame;
}
function playFinish() {
myFrameRate = 12;
myFrameTime = 1000 / myFrameRate;
t = getTimer();
gotoAndStop (3);
onEnterFrame = function () {
if ((t + myFrameTime) < getTimer()) {
nextFrame();
t = getTimer();
if (_currentframe == _totalframes) {
myRoot.gameOver();
inside._width = 0;
delete onEnterFrame;
}
}
};
}
maxWidth = inside._width;
inside._width = 0;
if (_name == "loader") {
preload();
} else {
init();
}
stop();
Symbol 33 MovieClip Frame 1
function init() {
delete waitFor;
myValue = 100;
_visible = false;
gotoAndStop ("invisible");
row = randomInt(0, 6);
multiplier = 7 - row;
this.swapDepths((row * 10000) + 9999);
dep = this.getDepth();
_yscale = myRoot.rowsList[row].scale;
_xscale = myRoot.rowsList[row].scale;
dir = dir * -1;
_x = ((dir == 1) ? 0 : (origX));
_y = myRoot.rowsList[row].y;
useHandCursor = false;
hitArea = hitArea1;
hitArea1._visible = false;
hitArea2._visible = false;
startTimer = getTimer();
frame = 0;
onEnterFrame = waitForRelease;
}
function waitForRelease() {
t = getTimer();
if ((t - startTimer) < startRate) {
_visible = true;
gotoAndStop(((dir == 1) ? 4 : 2));
pumpkin._visible = false;
onPress = collect;
onEnterFrame = startWalking;
}
}
function startWalking() {
lastT = t;
t = getTimer();
if (((dir == 1) && (_x > origX)) || ((dir == -1) && (_x < (-(_width / 2))))) {
trace("!!!!!!!!!!!!!!!!!!");
if (pumpkin._visible == true) {
myRoot.gameOver();
} else {
delete onEnterFrame;
init();
}
} else {
if (frame == 0) {
frame = 1;
nextFrame();
} else {
frame = 0;
prevFrame();
}
_x = (_x + (((t - lastT) / walkDistance) * dir));
if (pumpkin._visible == false) {
myZone = Math.round((_x - myRoot.leftBoundary) / myRoot.rowsList[row].w);
if (myRoot.locations[(row * 100) + myZone].growing > 0) {
if (Math.abs(_x - myRoot.locations[(row * 100) + myZone]._x) <= walkDistance) {
waitFor = myRoot.locations[(row * 100) + myZone]._name;
onEnterFrame = waitForPumpkin;
}
}
}
}
}
function collect(playSound) {
myRoot.scoreBoard.addScore(myValue * multiplier);
myRoot.showThePoints(myValue * multiplier, _x, _y + (_height / 2), _xscale);
c = ((myValue == 10) ? 1 : 3);
if (playSound != false) {
myRoot.playTheSound("rat" + myValue, 0);
}
init();
}
function hideMe() {
var _local1 = this;
_local1._visible = false;
_local1.gotoAndStop("invisible");
delete _local1.onEnterFrame;
}
function waitForPumpkin() {
if (myRoot[waitFor].growing > 1) {
pumpkin._visible = true;
hitArea = hitArea2;
myValue = 1000;
t = getTimer();
onEnterFrame = startWalking;
myRoot[waitFor].destroyMe();
} else if (myRoot[waitFor] == undefined) {
t = getTimer();
onEnterFrame = startWalking;
}
}
dir = ((randomInt(1, 2) == 1) ? 1 : -1);
origX = _x;
hideMe();
startRate = Number(myRoot.defaultValues.ratReleaseRate);
walkDistance = Number(myRoot.defaultValues.ratWalkDistance);
stop();
Symbol 51 Button
on (press) {
getURL ("http://www.cbc.ca/kids");
}
Symbol 71 MovieClip Frame 1
myFrameRate = 12;
myFrameTime = 1000 / myFrameRate;
t = getTimer();
stop();
onEnterFrame = function () {
if ((t + myFrameTime) < getTimer()) {
nextFrame();
t = getTimer();
if (_currentframe == _totalframes) {
delete onEnterFrame;
}
}
};
Symbol 73 Button
on (press) {
showHelp();
}
Symbol 75 Button
on (press) {
myRoot.startGame();
}
Symbol 78 Button
on (press) {
myRoot.startGame();
}
Symbol 79 MovieClip Frame 1
function hideMe() {
delete onEnterFrame;
gotoAndStop(_totalframes);
_visible = false;
}
function showMe() {
delete onEnterFrame;
gotoAndStop(_totalframes - 2);
_visible = true;
}
function showHelp() {
delete onEnterFrame;
_visible = true;
gotoAndStop(_totalframes - 1);
}
myFrameRate = 12;
myFrameTime = 1000 / myFrameRate;
t = getTimer();
stop();
onEnterFrame = function () {
if ((t + myFrameTime) < getTimer()) {
nextFrame();
t = getTimer();
if (_currentframe == (_totalframes - 2)) {
delete onEnterFrame;
}
}
};
Symbol 86 Button
on (press) {
hideMe();
}
Symbol 87 MovieClip Frame 1
function hideMe() {
gotoAndStop (3);
_visible = false;
}
function showMe() {
trace("showme");
gotoAndStop (2);
_visible = true;
f = 0;
t = getTimer();
onEnterFrame = function () {
level = myRoot.level;
posted = myRoot.posted;
f++;
if (getTimer() > (t + 1000)) {
fr = "FR:" + f;
f = 0;
t = getTimer();
}
};
}
hideMe();
Symbol 99 Button
on (press) {
if (musicOnOff == "music on") {
stopTheSound("bgMusic", true);
musicOnOff = "music off";
} else {
playTheSound("bgMusic", 9999, true);
musicOnOff = "music on";
}
}
Symbol 102 MovieClip Frame 1
function addScore(howMuch) {
score = score + howMuch;
}
function reset() {
score = 0;
}
reset();
Symbol 121 MovieClip [pumpkin] Frame 1
function init() {
growing = 0;
var _local1 = randomInt(0, 6);
multiplier = 7 - _local1;
stealableFrame = 40;
animationFrames = 71;
clickableFrames = 68;
pressFrame = 16;
this.swapDepths((_local1 * 10000) + this.getDepth());
this._rotation = this._rotation + ((randomInt(0, 2) - 1) * randomInt(1, 7));
var _local3 = myRoot.rowsList[_local1].tm;
var _local2 = randomInt(0, _local3 - 1);
_x = ((_local2 * myRoot.rowsList[_local1].w) + (myRoot.rowsList[_local1].w / 2));
_yscale = myRoot.rowsList[_local1].scale;
_xscale = myRoot.rowsList[_local1].scale;
_y = myRoot.rowsList[_local1].y;
myLocation = (100 * _local1) + _local2;
if (myRoot.locations[myLocation] != undefined) {
me.removeMovieClip();
} else {
myRoot.locations[myLocation] = me;
gotoAndStop (2);
useHandCursor = false;
growthRate = Number(myRoot.growthRate);
myValue = 10;
birth = (growthTimer = getTimer());
onEnterFrame = mainTimer;
stop();
}
}
function hideMe() {
this._visible = false;
this.gotoAndStop("invisible");
}
function collect(playSound) {
trace("collect");
myRoot.locations[myLocation] = undefined;
myRoot.scoreBoard.addScore(myValue * multiplier);
myRoot.showThePoints(myValue * multiplier, _x, _y, _xscale);
if (playSound != false) {
myRoot.playTheSound("collect" + myValue);
}
me.removeMovieClip();
}
function mainTimer() {
t = getTimer();
if ((growthTimer + growthRate) < t) {
grow();
growthTimer = getTimer();
}
}
function grow() {
_visible = true;
calculatedFrame = Math.round((t - birth) / growthRate) + 2;
if (calculatedFrame > clickableFrames) {
calculatedFrame = clickableFrames + 1;
}
gotoAndStop(calculatedFrame);
if (((onPress == undefined) && (_currentframe >= pressFrame)) && (_currentframe <= clickableFrames)) {
hitArea = theHitArea;
theHitArea._visible = false;
growing = 1;
onPress = collect;
} else if ((_currentframe > stealableFrame) && (growing < 2)) {
growing = 2;
} else if ((_currentframe > clickableFrames) && (onPress != undefined)) {
explodeMe();
}
if (_currentframe >= 51) {
myValue = 100;
}
return(undefined);
}
function explodeMe(playSound) {
if (playSound != false) {
myRoot.playTheSound("explosion");
}
gotoAndStop ("pop");
growing = 0;
growthTimer = getTimer();
growthRate = Number(myRoot.defaultValues.explosionRate);
delete onPress;
onEnterFrame = explode;
}
function explode() {
t = getTimer();
if ((growthTimer + growthRate) < t) {
nextFrame();
if (_currentframe > animationFrames) {
myRoot.locations[myLocation] = undefined;
delete onEnterFrame;
myRoot.meter.bumpUp();
me.removeMovieClip();
} else {
growthTimer = getTimer();
}
}
}
function pauseMe() {
delete onEnterFrame;
delete onPress;
}
function destroyMe() {
trace("destroyme:" + me);
myRoot.locations[myLocation] = undefined;
delete me.onEnterFrame;
me.removeMovieClip();
}
me = this;
if (_name.substr(0, 7) == "pumpkin") {
init();
} else {
hideMe();
}
Symbol 123 MovieClip [showPoints] Frame 1
if (this._name == "showPoints") {
this._visible = false;
this.gotoAndStop("invisible");
} else {
already = true;
pointsRate = Number(myRoot.defaultValues.pointsRate);
growthTimer = getTimer();
onEnterFrame = function () {
var _local1 = this;
t = getTimer();
if ((growthTimer + pointsRate) < t) {
if (_local1._currentframe >= (_local1._totalframes - 1)) {
_local1.removeMovieClip();
} else {
nextFrame();
}
growthTimer = getTimer();
}
};
}
stop();
Symbol 126 MovieClip Frame 1
function playMe() {
if ((_currentframe > 2) && (_currentframe < _totalframes)) {
return(undefined);
}
myFrameRate = 12;
myFrameTime = 1000 / myFrameRate;
t = getTimer();
gotoAndStop (3);
onEnterFrame = function () {
if ((t + myFrameTime) < getTimer()) {
nextFrame();
t = getTimer();
if (_currentframe == _totalframes) {
stop();
delete onEnterFrame;
}
}
};
}
gotoAndStop (2);
this.hitArea = theHitArea;
theHitArea._visible = false;
this.onRollOver = function () {
playMe();
};
this.onPress = function () {
myRoot.startGame();
};
Symbol 133 Button
on (press) {
hideMe();
myRoot.introScreen.showHelp();
}
Symbol 136 Button
on (release) {
username = username.trim();
if ((username == "Your Name Here") || (username == "")) {
myRoot.playTheSound("dingSound");
invisibleButton._visible = true;
username = "Your Name Here";
var temp = new TextFormat();
temp.color = 16711680 /* 0xFF0000 */;
usernameField.setTextFormat(temp);
} else {
postScore();
saving._visible = true;
userNameField._visible = false;
playAgainButton._visible = false;
instructionsButton._visible = false;
postButton._visible = false;
nameBG._visible = false;
i = setInterval(reset, 1000);
}
}
Symbol 145 Button
on (press) {
invisibleButton._visible = false;
username = "";
Selection.setFocus(usernameField);
}
Symbol 148 MovieClip Frame 1
function hideMe() {
delete onEnterFrame;
gotoAndStop(_totalframes);
this._visible = false;
}
function playMe() {
trace("game over play me");
t = getTimer();
gotoAndStop (3);
if (username != "Your Name Here") {
invisibleButton._visible = false;
}
invisibleButton.useHandCursor = false;
saving._visible = false;
score = myRoot.scoreboard.score;
onEnterFrame = function () {
if (_currentframe >= 13) {
this._visible = true;
}
if ((t + myFrameTime) < getTimer()) {
nextFrame();
t = getTimer();
if (_currentframe == (_totalframes - 1)) {
delete onEnterFrame;
}
}
};
}
function postscore() {
scoreSend = new LoadVars();
scoreSend.score = myRoot.scoreBoard.score;
scoreSend.username = username.toUpperCase();
scoreSend.action = "submitscore";
scoreSend.gameid = 340;
scoreSend.clientid = 1;
scoreRecieve = new LoadVars();
scoreSend.sendAndLoad("/kids/games/submitscore.jsp", scoreRecieve, "POST");
scoreRecieve.onData = function (all) {
myRoot.posted = all;
};
}
function reset() {
trace("interval");
hideMe();
myRoot.introScreen.showMe();
clearInterval(i);
}
myFrameRate = 12;
myFrameTime = 1000 / myFrameRate;
hideMe();