home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar 2003 December (Special)
/
Gamestar-Special_2003-12_cd.bin
/
Arkady
/
arcanoid_gy.exe
/
scripts
/
frame_6
/
DoAction.as
Wrap
Text File
|
2002-11-22
|
13KB
|
535 lines
function AddString()
{
i = 0;
while(i < 12)
{
j = 14;
while(j >= 0)
{
field[(j + 1) * 12 + i] = field[j * 12 + i];
field[j * 12 + i] = 0;
if(field[(j + 1) * 12 + i] != 0)
{
removeMovieClip("x" + i + "y" + j);
attachMovie(word + field[(j + 1) * 12 + i],"x" + i + "y" + (j + 1),(j + 1) * 12 + i);
tellTarget("x" + i + "y" + (j + 1))
{
_X = 22 + _parent.i * 38 + _width / 2;
_Y = 20 + (_parent.j + 1) * 20 + _height / 2;
}
}
j--;
}
i++;
}
j = 0;
i = 0;
while(i < 6)
{
field[j * 12 + i] = GenerateBlock();
field[j * 12 + 11 - i] = field[j * 12 + i];
if(0 < field[j * 12 + i])
{
brickname = word + field[j * 12 + i];
attachMovie(brickname,"x" + i + "y" + j,j * 12 + i);
attachMovie(brickname,"x" + (11 - i) + "y" + j,j * 12 + 11 - i);
tellTarget("x" + i + "y" + j)
{
_X = 22 + _parent.i * 38 + _width / 2;
_Y = 20 + _parent.j * 20 + _height / 2;
}
tellTarget("x" + (11 - i) + "y" + j)
{
_X = 22 + (11 - _parent.i) * 38 + _width / 2;
_Y = 20 + _parent.j * 20 + _height / 2;
}
}
i++;
}
parity_flag = !parity_flag;
last_string++;
if(last_string >= 13)
{
gotoAndPlay(10);
}
}
br = 0;
Platform._width = plat_width;
i = 0;
while(i < 12)
{
if(field[last_string * 12 + i] != 0)
{
br++;
}
i++;
}
if(br == 0)
{
last_string--;
}
Date2 = new Date();
if(Aseconds < Math.abs(Date2 - Date1))
{
platform_vh = 0;
}
if(begin_flag)
{
Ball._x = Platform._x;
Ball._y = Platform._y - Ball._Height;
}
else
{
Ball._x += vx;
Ball._y += vy;
if(Ball._x < left)
{
was_beat_flag = false;
if(sound_flag)
{
Sound2.start();
}
push_flag = false;
if(abs_vx < Math.abs(vx))
{
vx += 1;
}
if(vy < - abs_vy - 1)
{
vy += 1;
}
else if(abs_vy + 1 < vy)
{
vy -= 1;
}
vx = Math.abs(vx);
Ball._x = left;
}
else if(right < Ball._x)
{
was_beat_flag = false;
if(sound_flag)
{
Sound2.start();
}
push_flag = false;
if(abs_vx < vx)
{
vx -= 1;
}
if(vy < - abs_vy - 1)
{
vy += 1;
}
else if(abs_vy + 1 < vy)
{
vy -= 1;
}
vx = - Math.abs(vx);
Ball._x = right;
}
if(Ball._y < top + Ball._width / 2)
{
was_beat_flag = false;
if(sound_flag)
{
Sound2.start();
}
push_flag = false;
vy = Math.abs(vy);
if(abs_vy + 1 < vy)
{
vy -= 1;
}
Ball._y = top + Ball._width / 2;
}
else if(bottom < Ball._y)
{
if(max_series < series_)
{
max_series = series_;
}
series_ = 0;
if(max_hit < hits)
{
max_hit = hits;
}
hits = 0;
vx = abs_vx;
vy = - abs_vy;
begin_flag = true;
Ball._x = Platform._x;
Ball._y = Platform._y - Ball._Height;
vx = abs_vx;
if(random(2) == 1)
{
vx = - vx;
}
AddString();
wasfall_flag = true;
if(sound_flag)
{
Sound4.start();
}
}
if(wasvertical_flag || Platform._x - Platform._width / 2 < Ball._x && Ball._x < Platform._x + Platform._width / 2 && Platform._y - 8 < Ball._y && Ball._y < Platform._y + Platform._height / 2 + 10)
{
BeatDate2 = new Date();
Ball._y = Platform._y - Platform._height / 2 - Ball._Height - 5;
if(BeatDate2 - BeatDate >= BeatSeconds)
{
tmptmp = Platform._y;
BeatDate = BeatDate2;
wasvertical_flag = false;
if(stick_flag && !push_flag)
{
begin_flag = true;
}
if(sound_flag)
{
Sound2.start();
}
Date2 = new Date();
if(platform_vh < 0)
{
vy = - Math.abs(vy) - Math.abs(platform_vh);
if(vy >= 0)
{
vy = - abs_vy;
}
}
else
{
vy = - Math.abs(vy) + 2 * Math.abs(platform_vh);
if(vy >= -1)
{
vy = - abs_vy;
}
}
if(Aseconds < Math.abs(Date2 - Date1))
{
platform_vh = 0;
}
else if(max_hit < hits)
{
max_hit = hits;
}
vx += platform_v;
if(vy < -8)
{
vy = -8;
}
if(vx < -6)
{
vx = -6;
}
if(6 < vx)
{
vx = 6;
}
if(vx == 0)
{
vx = random(2 * abs_vx) - 3;
}
platform_v = 0;
platform_vh = 0;
if(hits == 0 && !push_flag && !wasfall_flag)
{
AddString();
if(sound_flag && !wasvertical_flag)
{
Sound4.start();
}
}
wasfall_flag = false;
push_flag = true;
hits = 0;
Ball._y = Platform._y - Platform._height / 2 - Ball._Height - 5;
}
}
}
bally = int((Ball._y - 28) / 20);
ballx = int((Ball._x - 22) / 38);
if(11 < ballx)
{
ballx = 11;
}
if(bally < 0)
{
bally = 0;
}
if(last_string >= bally && field[bally * 12 + ballx] != 0)
{
was_beat_flag = false;
push_flag = false;
field[bally * 12 + ballx]--;
if(field[bally * 12 + ballx] == 0)
{
if(sound_flag)
{
Sound3.start();
}
tellTarget("x" + ballx + "y" + bally)
{
gotoAndPlay(2);
}
scores += 10 * (last_string - bally + 5);
series_ += 10 * (last_string - bally + 5);
hits += 10 * (last_string - bally + 5);
minus += 10 * (last_string - bally + 5);
}
else
{
if(sound_flag)
{
Sound1.start();
}
clipname = "x" + ballx + "y" + bally;
removeMovieClip(clipname);
attachMovie(word + field[bally * 12 + ballx],clipname,bally * 12 + ballx);
tellTarget(clipname)
{
_X = 22 + _parent.ballx * 38 + _width / 2;
_Y = 20 + _parent.bally * 20 + _height / 2;
}
scores += 10;
series_ += 10;
hits += 10;
minus += 10;
}
vy = - vy;
}
else
{
tempx = ballx * 38 + 22;
if(last_string >= bally && 0 < ballx && vx < 0 && field[bally * 12 + ballx - 1] != 0 && Math.abs(tempx - Ball._x) < 10)
{
was_beat_flag = false;
push_flag = false;
field[bally * 12 + ballx - 1]--;
if(field[bally * 12 + ballx - 1] == 0)
{
if(sound_flag)
{
Sound3.start();
}
tellTarget("x" + (ballx - 1) + "y" + bally)
{
gotoAndPlay(2);
}
scores += 10 * (last_string - bally + 5);
series_ += 10 * (last_string - bally + 5);
hits += 10 * (last_string - bally + 5);
minus += 10 * (last_string - bally + 5);
}
else
{
if(sound_flag)
{
Sound1.start();
}
clipname = "x" + (ballx - 1) + "y" + bally;
removeMovieClip(clipname);
attachMovie(word + field[bally * 12 + ballx - 1],clipname,bally * 12 + ballx - 1);
tellTarget(clipname)
{
_X = 22 + (_parent.ballx - 1) * 38 + _width / 2;
_Y = 20 + _parent.bally * 20 + _height / 2;
}
scores += 10;
series_ += 10;
hits += 10;
minus += 10;
}
vx = - vx;
}
tempx = (ballx + 1) * 38 + 22;
if(last_string >= bally && ballx < 11 && 0 < vx && field[bally * 12 + ballx + 1] != 0 && Math.abs(tempx - Ball._x) < 10)
{
was_beat_flag = false;
push_flag = false;
field[bally * 12 + ballx + 1]--;
if(field[bally * 12 + ballx + 1] == 0)
{
if(sound_flag)
{
Sound3.start();
}
tellTarget("x" + (ballx + 1) + "y" + bally)
{
gotoAndPlay(2);
}
scores += 10 * (last_string - bally + 5);
series_ += 10 * (last_string - bally + 5);
hits += 10 * (last_string - bally + 5);
minus += 10 * (last_string - bally + 5);
}
else
{
if(sound_flag)
{
Sound1.start();
}
clipname = "x" + (ballx + 1) + "y" + bally;
removeMovieClip(clipname);
attachMovie(word + field[bally * 12 + ballx + 1],clipname,bally * 12 + ballx + 1);
tellTarget(clipname)
{
_X = 22 + (_parent.ballx + 1) * 38 + _width / 2;
_Y = 20 + _parent.bally * 20 + _height / 2;
}
scores += 10;
series_ += 10;
hits += 10;
minus += 10;
}
vx = - vx;
}
}
bally = int((Ball._y - 16) / 20);
if(bally < 0)
{
bally = 0;
}
if(last_string >= bally && field[bally * 12 + ballx] != 0)
{
was_beat_flag = false;
push_flag = false;
field[bally * 12 + ballx]--;
if(field[bally * 12 + ballx] == 0)
{
if(sound_flag)
{
Sound3.start();
}
tellTarget("x" + ballx + "y" + bally)
{
gotoAndPlay(2);
}
scores += 10 * (last_string - bally + 5);
series_ += 10 * (last_string - bally + 5);
hits += 10 * (last_string - bally + 5);
minus += 10 * (last_string - bally + 5);
}
else
{
if(sound_flag)
{
Sound1.start();
}
clipname = "x" + ballx + "y" + bally;
removeMovieClip(clipname);
attachMovie(word + field[bally * 12 + ballx],clipname,bally * 12 + ballx);
tellTarget(clipname)
{
_X = 22 + _parent.ballx * 38 + _width / 2;
_Y = 20 + _parent.bally * 20 + _height / 2;
}
scores += 10;
series_ += 10;
hits += 10;
minus += 10;
}
vy = - vy;
}
else
{
tempx = ballx * 38 + 22;
if(last_string >= bally && 0 < ballx && vx < 0 && field[bally * 12 + ballx - 1] != 0 && Math.abs(tempx - Ball._x) < 10)
{
was_beat_flag = false;
push_flag = false;
field[bally * 12 + ballx - 1]--;
if(field[bally * 12 + ballx - 1] == 0)
{
if(sound_flag)
{
Sound3.start();
}
tellTarget("x" + (ballx - 1) + "y" + bally)
{
gotoAndPlay(2);
}
scores += 10 * (last_string - bally + 5);
series_ += 10 * (last_string - bally + 5);
hits += 10 * (last_string - bally + 5);
minus += 10 * (last_string - bally + 5);
}
else
{
if(sound_flag)
{
Sound1.start();
}
clipname = "x" + (ballx - 1) + "y" + bally;
removeMovieClip(clipname);
attachMovie(word + field[bally * 12 + ballx - 1],clipname,bally * 12 + ballx - 1);
tellTarget(clipname)
{
_X = 22 + (_parent.ballx - 1) * 38 + _width / 2;
_Y = 20 + _parent.bally * 20 + _height / 2;
}
scores += 10;
series_ += 10;
hits += 10;
minus += 10;
}
vx = - vx;
}
tempx = (ballx + 1) * 38 + 22;
if(last_string >= bally && ballx < 11 && 0 < vx && field[bally * 12 + ballx + 1] != 0 && Math.abs(tempx - Ball._x) < 10)
{
was_beat_flag = false;
push_flag = false;
field[bally * 12 + ballx + 1]--;
if(field[bally * 12 + ballx + 1] == 0)
{
if(sound_flag)
{
Sound3.start();
}
tellTarget("x" + (ballx + 1) + "y" + bally)
{
gotoAndPlay(2);
}
scores += 10 * (last_string - bally + 5);
series_ += 10 * (last_string - bally + 5);
hits += 10 * (last_string - bally + 5);
minus += 10 * (last_string - bally + 5);
}
else
{
if(sound_flag)
{
Sound1.start();
}
clipname = "x" + (ballx + 1) + "y" + bally;
removeMovieClip(clipname);
attachMovie(word + field[bally * 12 + ballx + 1],clipname,bally * 12 + ballx + 1);
tellTarget(clipname)
{
_X = 22 + (_parent.ballx + 1) * 38 + _width / 2;
_Y = 20 + _parent.bally * 20 + _height / 2;
}
scores += 10;
series_ += 10;
hits += 10;
minus += 10;
}
vx = - vx;
}
}
if(minus >= 50)
{
if(20 < Platform._width)
{
Platform._width--;
plat_width = Platform._width;
}
minus = 0;
}
Score = scores;
Series = series_;
Hit = hits;
gotoAndPlay(5);