Instance of Symbol 13 MovieClip in Frame 1
//component parameters
onClipEvent (construct) {
TrackEdgeColor = 16754726 /* 0xFFA826 */;
TrackColor = 3355443 /* 0x333333 */;
BarColor = 16750848 /* 0xFF9900 */;
TrackWidth = 100;
}
Frame 2
stop();
Mouse.show();
Frame 3
function randomBetween(lower, upper) {
return(lower + Math.floor(Math.random() * ((upper - lower) + 1)));
}
function newGame() {
Mouse.hide();
startDrag ("bat", true, lw._width, bat._y, (400 - bat._width) - rw._width, bat._y);
onMouseMove = function () {
ball._x = (bat._x + (bat._width / 2)) - (ball._width / 2);
ball._y = bat._y - ball._height;
updateAfterEvent();
};
onMouseDown = function () {
releaseBall();
delete onMouseDown;
};
hitCount = 0;
createNewBlocks();
clearInterval(drop);
drop = setInterval(dropBlocks, 1000);
}
function createNewBlocks() {
var _local6 = 7;
var _local7 = numRows;
block._y = startPos;
var _local4 = block._x;
var _local5 = block._y;
var _local2 = 1;
while (_local2 <= 100) {
removeMovieClip("block" + _local2);
_local2++;
}
_local2 = 1;
while (_local2 <= (_local6 * _local7)) {
duplicateMovieClip ("block", "block" + _local2, _local2);
var _local3 = this["block" + _local2];
_local3._x = _local4;
_local3._y = _local5;
if ((_local2 % _local6) == 0) {
_local4 = block._x;
_local5 = _local5 + (block._height + 10);
} else {
_local4 = _local4 + (block._width + 5);
}
numBlocks = _local2;
_local2++;
}
block._y = 2000;
}
function releaseBall() {
delete onMouseMove;
ball.yspeed = -6;
var _local2 = new Array(1, -1);
ball.xspeed = randomBetween(1, 5) * _local2[randomBetween(0, 1)];
ball.onEnterFrame = function () {
this._y = this._y + this.yspeed;
this._x = this._x + this.xspeed;
collisionDetect();
};
}
function pauseGame() {
trace("Paused");
}
function collisionDetect() {
if (hitBlock()) {
ball.yspeed = ball.yspeed * -1;
ball.batted = false;
} else if (ball.hitTest(bat) && (!ball.batted)) {
ball.yspeed = ball.yspeed * -1;
ball.batted = true;
var bat = new Sound();
bat.attachSound("bat");
bat.start();
} else if (ball.hitTest(lw) || (ball.hitTest(rw))) {
ball.xspeed = ball.xspeed * -1;
if (ball.xspeed < 0) {
ball._x = ball._x - 5;
}
if (ball.xspeed > 0) {
ball._x = ball._x + 5;
}
ball.batted = false;
} else if (ball.hitTest(tw)) {
ball.yspeed = ball.yspeed * -1;
if (ball.yspeed < 0) {
ball._y = ball._y - 5;
}
if (ball.yspeed > 0) {
ball._y = ball._y + 5;
}
ball.batted = false;
} else if (ball.hitTest(bw) || (block.hitTest(bw))) {
delete ball.onEnterFrame;
lives--;
if (lives == 0) {
trace("Game Over");
gotoAndStop (4);
hits = 0;
games = 0;
lives = 3;
numRows = 1;
}
newGame();
}
}
function hitBlock() {
var _local2 = 1;
while (_local2 <= numBlocks) {
var _local3 = this["block" + _local2];
if (ball.hitTest(_local3)) {
removeMovieClip(_local3);
hitCount++;
hits = hits + 10;
score = score + 10;
var _local4 = new Sound();
_local4.attachSound("beep");
_local4.start();
if (hitCount == numBlocks) {
games++;
numRows = numRows + 1;
delete ball.onEnterFrame;
newGame();
}
return(true);
}
_local2++;
}
}
function dropBlocks() {
var _local2 = 1;
while (_local2 <= numBlocks) {
var _local3 = _root["block" + _local2];
_local3._y = _local3._y + 2;
_local2++;
}
if (_local3.hitTest(bw)) {
delete ball.onEnterFrame;
lives--;
if (lives == 0) {
trace("Game Over");
gotoAndStop (4);
hits = 0;
games = 0;
lives = 3;
numRows = 1;
}
newGame();
}
}
if (Key.getCode() == 80) {
pauseGame();
}
stop();
numRows = 1;
startPos = 35;
games = 1;
score = 0;
hits = 0;
lives = 3;
newGame();
Frame 4
Mouse.show();
stopAllSounds();
if (score <= 70) {
scoreMessage = "That was abysmal! Try Again.";
} else if (score <= 200) {
scoreMessage = "That was pretty bad! Try Again.";
} else if (score < 500) {
scoreMessage = "That's not good enough, pick it up! Try Again.";
} else if (score <= 750) {
scoreMessage = "That was Okay but there's room for improvement! Try Again.";
} else if (score <= 1000) {
scoreMessage = "Good Hussle! Try and beat it.";
} else if (score > 1500) {
scoreMessage = "That was Awesome! Have another go.";
}
Symbol 13 MovieClip Frame 1
if (TrackWidth <= 100) {
TrackWidth = 100;
}
if (TrackWidth >= 300) {
TrackWidth = 300;
}
LoadingTrack._xscale = TrackWidth;
LoadingTrackEdge._xscale = TrackWidth;
LoadingBar._xscale = TrackWidth;
LdBarColor = BarColor;
LoadingBarColor = new Color(LoadingBar);
LoadingBarColor.setRGB(LdBarColor);
TrkColor = TrackColor;
TheTrackColor = new Color(LoadingTrack);
TheTrackColor.setRGB(TrkColor);
TrkEdgeColor = TrackEdgeColor;
LoadingBarColor = new Color(LoadingTrackEdge);
LoadingBarColor.setRGB(TrkEdgeColor);
_parent.stop();
stop();
LoadingText.text = ((Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100) + "% of ") + Math.round(_root.getBytesTotal() / 1000)) + "K Loaded";
LoadingBar._xscale = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * TrackWidth);
LoadingBar._x = ((LoadingTrack._x - ((LoadingTrack._xscale / 2) + 1)) + (LoadingBar._xscale / 2)) - 1;
ifFrameLoaded (_parent._totalframes) {
gotoAndPlay (3);
}
play();
Symbol 13 MovieClip Frame 2
gotoAndPlay (1);
Symbol 13 MovieClip Frame 3
stop();
_parent.play();
Symbol 19 Button
on (release) {
gotoAndPlay (3);
}
Symbol 44 Button
on (release) {
gotoAndStop (3);
}