Frame 4
area_x1 = 80;
area_x2 = 520;
area_y1 = 32;
area_y2 = 460;
block_max = 36;
block_exist = new Array(block_max);
block_type = new Array(block_max);
block_x = new Array(block_max);
block_y = new Array(block_max);
block_w = 18;
block_h = 6;
c = 0;
i = 0;
while (i < 3) {
j = 0;
while (j < 12) {
block_x[c] = (area_x1 + 22) + (j * 36);
block_y[c] = (area_y1 + 56) + (i * 24);
c++;
j++;
}
i++;
}
pad_r = 32;
pad_add = 4;
pad_rmax = 64;
pad_rmin = 16;
ball_spd = 8;
ball_spdmax = 12;
ball_spdmin = 4;
ball_r = 8;
ball_ax = 0;
ball_ay = 0;
level = 1;
stock = 3;
item_max = 0;
SndPad = new Sound();
SndPad.attachSound("W_PAD.WAV");
SndWall = new Sound();
SndWall.attachSound("W_WALL.WAV");
SndBlock = new Sound();
SndBlock.attachSound("W_BLOCK.WAV");
Frame 5
function start_game() {
mcBall._visible = true;
mcBall._x = mcPad._x;
mcBall._y = (mcPad._y - pad_r) - ball_r;
mcBall._visible = true;
var _local2 = 240 + (Math.random() * 60);
var _local1 = (Math.PI * _local2) / 180;
ball_ax = Math.cos(_local1);
ball_ay = Math.sin(_local1);
gotoAndPlay ("game");
}
Frame 9
this.stop();
stock = 3;
level = 1;
item_max = 0;
pad_r = 32;
ball_spd = 7;
Frame 14
item_max = item_max + 4;
if (item_max >= block_max) {
item_max = 4;
}
mcPad.ox = mcPad._x;
mcPad._xscale = (100 * pad_r) / 32;
mcPad._yscale = (100 * pad_r) / 32;
mcPad.gotoAndStop(1);
mcBall._visible = false;
i = 0;
while (i < block_max) {
block_exist[i] = 1;
block_type[i] = 1;
i++;
}
i = 0;
while (i < item_max) {
n = Math.floor(Math.random() * block_max);
block_type[n] = 2 + Math.floor(Math.random() * 4);
i++;
}
i = 0;
while (i < block_max) {
mc = eval ("mcBlock" + i);
mc._x = block_x[i];
mc._y = block_y[i];
mc._visible = true;
mc.gotoAndStop(block_type[i]);
i++;
}
level_txt = "level" + level;
stock_txt = "ball" + stock;
gotoAndStop ("restart");
Instance of Symbol 22 MovieClip "mcPad" in Frame 14
onClipEvent (enterFrame) {
x = _root._xmouse;
if (x < (_parent.area_x1 + _parent.pad_r)) {
x = _parent.area_x1 + _parent.pad_r;
}
if (x > (_parent.area_x2 - _parent.pad_r)) {
x = _parent.area_x2 - _parent.pad_r;
}
this._x = x;
}
Frame 19
this.stop();
Frame 26
snd_type = 0;
pad_ox = mcPad.ox;
px = mcPad._x;
py = mcPad._y;
sa = px - pad_ox;
pr = pad_r;
d = pr;
x1 = area_x1 + ball_r;
x2 = area_x2 - ball_r;
y1 = area_y1 + ball_r;
y2 = area_y2 - ball_r;
bw = block_w;
bh = block_h;
check_clear = 0;
i = 0;
while (i < ball_spd) {
px = pad_ox + ((sa * (i + 1)) / ball_spd);
f = 0;
if ((mcBall._x >= (px - d)) && (mcBall._x <= (px + d))) {
if ((mcBall._y >= (py - d)) && (mcBall._y <= (py + d))) {
if (Math.sqrt(((mcBall._x - px) * (mcBall._x - px)) + ((mcBall._y - py) * (mcBall._y - py))) <= d) {
f = 1;
}
}
}
if (f) {
k = Math.atan2(mcBall._y - py, mcBall._x - px);
ball_ax = Math.cos(k);
ball_ay = Math.sin(k);
mcPad._rotation = (180 * k) / Math.PI;
mcPad.gotoAndPlay(2);
if ((ball_ay > -0.1) && (ball_ay < 0.1)) {
ball_ay = -0.1;
}
mcBall._x = px + (Math.cos(k) * (pr + 1));
mcBall._y = py + (Math.sin(k) * (pr + 1));
snd_type = 1;
}
erase_block = -1;
naname = -1;
j = 0;
for ( ; j < block_max ; j++) {
if (!block_exist[j]) {
} else {
bx = block_x[j];
by = block_y[j];
if ((mcBall._x < ((bx - bw) - ball_r)) || (mcBall._x > ((bx + bw) + ball_r))) {
} else if ((mcBall._y < ((by - bh) - ball_r)) || (mcBall._y > ((by + bh) + ball_r))) {
} else {
if ((mcBall._x >= (bx - bw)) && (mcBall._x <= (bx + bw))) {
ball_ay = ball_ay * -1;
} else if ((mcBall._y >= (by - bh)) && (mcBall._y <= (by + bh))) {
ball_ax = ball_ax * -1;
} else {
naname = j;
continue;
}
erase_block = j;
break;
}
}
}
if ((naname >= 0) && (erase_block < 0)) {
bx = block_x[naname];
by = block_y[naname];
f = 0;
if ((mcBall._y > ((mcBall._x + (by - bh)) - (bx - bw))) && (mcBall._y < (((-mcBall._x) + (bx - bw)) + (by + bh)))) {
f = 1;
}
if ((mcBall._y > (((-mcBall._x) + (by - bh)) + (bx + bw))) && (mcBall._y < ((mcBall._x + (bx + bw)) + (by + bh)))) {
f = 1;
}
if (f) {
ff = 0;
if ((mcBall._x < bx) && (ball_ax < 0)) {
ff = 1;
}
if ((mcBall._x > bx) && (ball_ax > 0)) {
ff = 1;
}
if (ff) {
ball_ay = ball_ay * -1;
} else {
ball_ax = ball_ax * -1;
}
} else {
ball_ay = ball_ay * -1;
}
erase_block = naname;
}
if (erase_block >= 0) {
mc = eval ("mcBlock" + erase_block);
mc._visible = false;
block_exist[erase_block] = 0;
switch (block_type[erase_block]) {
case 2 :
ball_spd--;
if (ball_spd < ball_spdmin) {
ball_spd = ball_spdmin;
}
break;
case 3 :
ball_spd++;
if (ball_spd > ball_spdmax) {
ball_spd = ball_spdmax;
}
break;
case 4 :
pad_r = pad_r + pad_add;
if (pad_r > pad_rmax) {
pad_r = pad_rmax;
}
mcPad._xscale = (100 * pad_r) / 32;
mcPad._yscale = (100 * pad_r) / 32;
break;
case 5 :
pad_r = pad_r - pad_add;
if (pad_r < pad_rmin) {
pad_r = pad_rmin;
}
mcPad._xscale = (100 * pad_r) / 32;
mcPad._yscale = (100 * pad_r) / 32;
}
check_clear = 1;
snd_type = 3;
}
if (mcBall._x < x1) {
mcBall._x = x1;
ball_ax = ball_ax * -1;
snd_type = 2;
}
if (mcBall._x > x2) {
mcBall._x = x2;
ball_ax = ball_ax * -1;
snd_type = 2;
}
if (mcBall._y < y1) {
mcBall._y = y1;
ball_ay = ball_ay * -1;
snd_type = 2;
}
if ((ball_ay > -0.1) && (ball_ay < 0.1)) {
ball_ay = -0.1;
}
mcBall._x = mcBall._x + ball_ax;
mcBall._y = mcBall._y + ball_ay;
i++;
}
mcPad.ox = mcPad._x;
switch (snd_type) {
case 1 :
SndPad.start();
break;
case 2 :
SndWall.start();
break;
case 3 :
SndBlock.start();
}
if (check_clear) {
f = 0;
i = 0;
while (i < block_max) {
if (block_exist[i]) {
if (block_type[i] == 1) {
f = 1;
}
}
i++;
}
if (f == 0) {
mcBall._visible = false;
gotoAndStop ("clear");
}
}
if (mcBall._y > y2) {
mcBall._visible = false;
stock--;
if (stock < 0) {
gotoAndPlay ("gameover");
} else {
stock_txt = "ball" + stock;
gotoAndStop ("restart");
}
}
Frame 27
gotoAndPlay(_currentframe - 1);
Frame 32
this.stop();
Frame 37
a = -80;
Frame 38
a = a + 2;
mcGameover._y = a;
Frame 39
if (a < 220) {
gotoAndPlay(_currentframe - 1);
}
Frame 40
this.stop();
Symbol 10 Button
on (press) {
gotoAndPlay ("start");
}
Symbol 20 MovieClip Frame 1
this.stop();
Symbol 22 MovieClip Frame 1
this.stop();
Symbol 29 Button
on (release) {
start_game();
}
Symbol 32 Button
on (press) {
level++;
gotoAndPlay ("start");
}
Symbol 35 Button
on (release) {
gotoAndStop ("title");
}