réctifications classes Bonus et Joueur
This commit is contained in:
parent
8a5a4b805a
commit
f6667c7327
|
|
@ -8,11 +8,11 @@ public class Bonus {
|
|||
int bPositionX;
|
||||
int bPositionY;
|
||||
|
||||
public int[] apparitionAleaB() {
|
||||
public int[] apparitionAleaB(Joueur joueur, Zombie zombie) {
|
||||
Random r = new Random();
|
||||
int posX = r.nextInt(10);
|
||||
int posY = r.nextInt(10);
|
||||
if ((bPositionX != Joueur.getjPositionX() && Zombie.getzombPositionX()) && (bPositionY != Joueur.getjPositionY() && Zombie.getzombPositionY())) {
|
||||
if (posX != joueur.getjPositionX() && posX != zombie.getZombPositionX() && posY != joueur.getjPositionY() && posY != zombie.getZombPositionY()) {
|
||||
bPositionX = posX;
|
||||
bPositionY = posY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,19 +32,19 @@ public class Joueur {
|
|||
jPositionY = newY;
|
||||
}
|
||||
|
||||
public void tuer() {
|
||||
if (Math.abs(Zombie.getZombPositionX() - jPositionX)<=2 && abs(Zombie.getZombPositionY() - jPositionY)<=2){
|
||||
if (Zombie.getZombPositionX() == jPositionX && Zombie.getZombPositionY() == jPositionY) {
|
||||
scoreVie = scoreVie - Zombie.getPointAttaque();
|
||||
public void tuer(Joueur joueur, Zombie zombie) {
|
||||
if (Math.abs(zombie.getZombPositionX() - jPositionX)<=2 && Math.abs(zombie.getZombPositionY() - jPositionY)<=2){
|
||||
if (zombie.getZombPositionX() == jPositionX && zombie.getZombPositionY() == jPositionY) {
|
||||
scoreVie = scoreVie - zombie.getPointAttaque();
|
||||
}
|
||||
else {
|
||||
if (Zombie.getPointDeVie() <= scoreAttaque) {
|
||||
nbrPoints = nbrPoints + Zombie.getPointDeVie();
|
||||
if (zombie.getPointDeVie() <= scoreAttaque) {
|
||||
nbrPoints = nbrPoints + zombie.getPointDeVie();
|
||||
nbrZombiesTues = nbrZombiesTues + 1;
|
||||
Zombie.setPointDeVie(0);
|
||||
zombie.setPointDeVie(0);
|
||||
}
|
||||
else {
|
||||
Zombie.setPointDeVie(Zombie.getPointDeVie() - scoreAttaque);
|
||||
zombie.setPointDeVie(zombie.getPointDeVie() - scoreAttaque);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,57 +4,54 @@ public class Zombie {
|
|||
private int pointAttaque;
|
||||
private int zombPositionX;
|
||||
private int zombPositionY;
|
||||
|
||||
public Zombie (int pointDeVie, int pointAttaque) {
|
||||
|
||||
public Zombie(int pointDeVie, int pointAttaque) {
|
||||
this.pointDeVie = pointDeVie;
|
||||
this.pointAttaque = pointAttaque;
|
||||
}
|
||||
|
||||
|
||||
public void deplacer() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void attaquer2() {
|
||||
if(zombPositionX equal Joueur.getjPositionX() & getZombPositionY() equal Joueur.getjPositionY()) {
|
||||
Joueur.setScoreVie(Joueur.getScoreVie() - Zombie.getPointAttaque());
|
||||
}
|
||||
}
|
||||
// public void attaquer2() {
|
||||
// if(zombPositionX equal Joueur.getjPositionX() & getZombPositionY() equal Joueur.getjPositionY()) {
|
||||
// Joueur.setScoreVie(Joueur.getScoreVie() - Zombie.getPointAttaque());
|
||||
// }
|
||||
// }
|
||||
public void apparitionAleaZ() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public int getZombPositionX() {
|
||||
return zombPositionX;
|
||||
}
|
||||
|
||||
public void setZombPositionX(int zombPositionX) {
|
||||
this.zombPositionX = zombPositionX;
|
||||
}
|
||||
|
||||
public int getZombPositionY() {
|
||||
return zombPositionY;
|
||||
}
|
||||
|
||||
public void setZombPositionY(int zombPositionY) {
|
||||
this.zombPositionY = zombPositionY;
|
||||
}
|
||||
|
||||
public int getPointDeVie() {
|
||||
return pointDeVie;
|
||||
}
|
||||
public void setPointDeVie (int pointDeVie) {
|
||||
this.pointDeVie = pointDeVie;
|
||||
|
||||
public void setPointDeVie(int pointDeVie) {
|
||||
this.pointDeVie = pointDeVie;
|
||||
}
|
||||
|
||||
public int getPointAttaque() {
|
||||
return pointAttaque;
|
||||
}
|
||||
public void setPointAttaque (int pointAttaque) {
|
||||
this.pointAttaque = pointAttaque;
|
||||
|
||||
public void setPointAttaque(int pointAttaque) {
|
||||
this.pointAttaque = pointAttaque;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue