Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider 1f5d9649 rédigé par Pierrick Lermite's avatar Pierrick Lermite
Parcourir les fichiers

Début implementation explosion en chaine

parent dc1604aa
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
package App.Bomb;
import java.util.ArrayList;
import App.*;
import App.Block.ImbreakableBlock;
import App.Block.OneLifeBlock;
......@@ -23,6 +25,7 @@ public class Bomb{
try {
int j = 1;
g.addFire(new Fire(x, y), g);
ArrayList<Bomb> bombs = g.getBombList();
for(int i = 1; i <= 4; i++){
switch (i) {
case 1:
......@@ -34,7 +37,18 @@ public class Bomb{
if(!(g.getGrid()[x + j ][y] instanceof ImbreakableBlock)){
g.addFire(new Fire(x + j, y), g);
}
/*
// Explosion en chaîne
if (bombs.size() > 0){
for(int k = 0; k < bombs.size() ; k++){
if(bombs.get(k).getX() == x + j &&
bombs.get(k).getY() == y ){
p.increasedBomb();
bombs.get(k).explosion(g);
}
}
}
*/
if (g.getGrid()[x + j ][y] instanceof OneLifeBlock ||
g.getGrid()[x + j ][y] instanceof ImbreakableBlock) {
g.destructBlock(x + j, y);
......@@ -52,7 +66,18 @@ public class Bomb{
if(!(g.getGrid()[x][y + j] instanceof ImbreakableBlock)){
g.addFire(new Fire(x, y + j), g);
}
/*
// Explosion en chaîne
if (bombs.size() > 0){
for(int k = 0; k < bombs.size() ; k++){
if(bombs.get(k).getX() == x &&
bombs.get(k).getY() == y + j ){
p.increasedBomb();
bombs.get(k).explosion(g);
}
}
}
*/
if (g.getGrid()[x][y + j] instanceof OneLifeBlock ||
g.getGrid()[x][y + j] instanceof ImbreakableBlock) {
g.destructBlock(x, y + j);
......@@ -70,6 +95,19 @@ public class Bomb{
if(!(g.getGrid()[x - j][y] instanceof ImbreakableBlock)){
g.addFire(new Fire(x - j, y), g);
}
/*
// Explosion en chaîne
if (bombs.size() > 0){
for(int k = 0; k < bombs.size() ; k++){
if(bombs.get(k).getX() == x - j &&
bombs.get(k).getY() == y ){
p.increasedBomb();
bombs.get(k).explosion(g);
}
}
}
*/
if (g.getGrid()[x - j][y] instanceof OneLifeBlock ||
g.getGrid()[x - j][y] instanceof ImbreakableBlock) {
......@@ -87,7 +125,18 @@ public class Bomb{
if(!(g.getGrid()[x][y - j] instanceof ImbreakableBlock)){
g.addFire(new Fire(x, y - j), g);
}
/*
// Explosion en chaîne
if (bombs.size() > 0){
for(int k = 0; k < bombs.size() ; k++){
if(bombs.get(k).getX() == x &&
bombs.get(k).getY() == y - j ){
p.increasedBomb();
bombs.get(k).explosion(g);
}
}
}
*/
if (g.getGrid()[x][y - j] instanceof OneLifeBlock ||
g.getGrid()[x][y - j] instanceof ImbreakableBlock ) {
g.destructBlock(x, y - j);
......
......@@ -334,6 +334,10 @@ public class Ground {
}.start();
}
public void deleteBomb(int i){
bombs.remove(i);
}
/**
* Détruit un bloc à la position (i, j) dans la grille de blocs.
* Ajoute un objet à la grille d'items si le bloc détruit est un bloc cassable.
......
......@@ -187,6 +187,10 @@ public class Player {
return new Bomb(3000,this.getGridX(),this.getGridY(),firePower, this);
}
public void increasedBomb(){
bombPlaced++;
}
/**
* Diminue la limite de bombes placées par le joueur.
*/
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter