Fix explosives bugs
This commit is contained in:
parent
0e8a46421f
commit
ca756c6e01
@ -27,16 +27,17 @@ public class Bomb extends Explosive implements CountdownBox {
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
Grid grid = game.getGrid();
|
||||
counter--;
|
||||
if(counter == 0) {
|
||||
for(int i = -EXPLOSION_SIZE; i < EXPLOSION_SIZE; i++) {
|
||||
for(int j = -EXPLOSION_SIZE; j < EXPLOSION_SIZE; j++) {
|
||||
if(pythagoras(i, j) <= EXPLOSION_SIZE) { // recherche en cercle, pas en carré
|
||||
Grid grid = game.getGrid();
|
||||
Point position = new Point(point.getA() + i, point.getB() + j);
|
||||
if(position.getA() >= 0 && position.getA() < grid.getRow()
|
||||
&& position.getB() >= 0 && position.getB() < grid.getColumn()) {
|
||||
interact(grid, null, position);
|
||||
Player player = grid.getBoard().get(position).getA();
|
||||
interact(grid, player, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ public abstract class Explosive extends AbstractBox implements InteractiveBox {
|
||||
|
||||
@Override
|
||||
public void interact(Grid grid, Player player, Point position) {
|
||||
if(grid.getBoard().get(position).getB() == this){
|
||||
grid.getBoard().get(position).setB(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user