rendered paste body
public class Barrier
{
boolean[] isSegmentAlive;
int x = 0;
int y = 0;
boolean contact = false;
public Barrier (int _x, int _y, boolean[] lives)
{
x = _x;
y = _y;
isSegmentAlive = lives;
}
public int getx ()
{
return x;
}
public int gety ()
{
return y;
}
public boolean[] checkAlive ()
{
return isSegmentAlive;
}
public void breakBarrier (int x, int y, int bullet_x, int bullet_y, boolean[] isSegmentAlive, boolean bullet_go)
{
if (bullet_x > x - 10 && bullet_x + 10 < x + 50 && bullet_y < y + 90 && isSegmentAlive [5] == true && isSegmentAlive [3] == true && isSegmentAlive [0] == true && bullet_go == true)
{
isSegmentAlive [5] = false;
contact = true;
}
if (bullet_x > x - 10 && bullet_x + 10 < x + 50 && bullet_y < y + 60 && isSegmentAlive [5] == false && isSegmentAlive [3] == true && isSegmentAlive [0] == true && bullet_go == true)
{
isSegmentAlive [3] = false;
contact = true;
}
if (bullet_x > x - 10 && bullet_x + 10 < x + 50 && bullet_y < y + 30 && isSegmentAlive [5] == false && isSegmentAlive [3] == false && isSegmentAlive [0] == true && bullet_go == true)
{
isSegmentAlive [0] = false;
contact = true;
}
if (bullet_x > x + 20 && bullet_x + 10 < x + 80 && bullet_y < y + 30 && isSegmentAlive [1] == true && bullet_go == true)
{
isSegmentAlive [1] = false;
contact = true;
}
if (bullet_x > x + 50 && bullet_x + 10 < x + 110 && bullet_y < y + 90 && isSegmentAlive [6] == true && isSegmentAlive [4] == true && isSegmentAlive [2] == true && bullet_go == true)
{
isSegmentAlive [6] = false;
contact = true;
}
if (bullet_x > x + 50 && bullet_x + 10 < x + 110 && bullet_y < y + 60 && isSegmentAlive [6] == false && isSegmentAlive [4] == true && isSegmentAlive [2] == true && bullet_go == true)
{
isSegmentAlive [4] = false;
contact = true;
}
if (bullet_x > x + 50 && bullet_x + 10 < x + 110 && bullet_y < y + 30 && isSegmentAlive [6] == false && isSegmentAlive [4] == false && isSegmentAlive [2] == true && bullet_go == true)
{
isSegmentAlive [2] = false;
contact = true;
}
}
public boolean checkHit (boolean bullet_go)
{
if (bullet_go == false)
{
contact = false;
}
return contact;
}
}