ajout des déplacements des zombies

This commit is contained in:
Amaury TRACLET 2023-04-29 20:17:18 +02:00
parent 6c56fc3a14
commit 4238dff15b
1 changed files with 5 additions and 6 deletions

View File

@ -43,7 +43,7 @@ public class Simulateur extends Thread {
MJF.getLblZombicide().setVisible(false);
// creation du joueur avec 5 points de vie et un score d'attaque à 3
joueur = new Joueur(5,3,0,0,POS_INITIALE_JOUEUR_X,POS_INITIALE_JOUEUR_Y);
joueur = new Joueur(5,5,0,0,POS_INITIALE_JOUEUR_X,POS_INITIALE_JOUEUR_Y);
plateau.setCase(POS_INITIALE_JOUEUR_X,POS_INITIALE_JOUEUR_Y,Plateau.JOUEUR_IN);
MJF.showJoueurInPanel(MJF.getPanelGrille(), joueur.getjPositionX(),joueur.getjPositionY());
MJF.updateNbZombiesTues(joueur.getNbrZombiesTues());
@ -51,8 +51,7 @@ public class Simulateur extends Thread {
// creation du tableau des Zombies
zombies = new Zombie[Plateau.TAILLE_X*Plateau.TAILLE_Y];
// création du premier zombie
ajouterUnZombie(0, Zombie.ZOMBIE);
MJF.updatePBAttaque(joueur.getScoreAttaque());
MJF.updatePBVie(joueur.getScoreVie());
@ -79,7 +78,7 @@ public class Simulateur extends Thread {
private void faireUneEtape() {
// ajouter un nouveau Zombie, ou un super zombie tous les 5 nouveaux zombies, et toutes les 10 étapes
if (valeur % 10 == 0) {
if (nbZombiesPlateau % 5 == 0) {
if (nbZombiesPlateau % 5 == 4) {
ajouterUnZombie(nbZombiesPlateau, Zombie.SUPERZOMBIE);
} else {
ajouterUnZombie(nbZombiesPlateau, Zombie.ZOMBIE);
@ -126,11 +125,11 @@ public class Simulateur extends Thread {
if (typeZombie == Zombie.ZOMBIE) {
plateau.setCase(zombies[zId].getZombPositionX(),zombies[zId].getZombPositionY(),plateau.getCase(zombies[zId].getZombPositionX(),zombies[zId].getZombPositionY())+Plateau.ZOMBIE_IN);
plateau.setCase(zombies[zId].getZombPositionX()-dx,zombies[zId].getZombPositionY()-dy,plateau.getCase(zombies[zId].getZombPositionX()-dx,zombies[zId].getZombPositionY()-dy)-Plateau.ZOMBIE_IN);
// mettre à jour la vue
} else if (typeZombie == Zombie.SUPERZOMBIE) {
plateau.setCase(zombies[zId].getZombPositionX(),zombies[zId].getZombPositionY(),plateau.getCase(zombies[zId].getZombPositionX(),zombies[zId].getZombPositionY())+Plateau.SUPER_ZOMBIE_IN);
plateau.setCase(zombies[zId].getZombPositionX()-dx,zombies[zId].getZombPositionY()-dy,plateau.getCase(zombies[zId].getZombPositionX()-dx,zombies[zId].getZombPositionY()-dy)-Plateau.SUPER_ZOMBIE_IN);
// mettre à jour la vue
}
if (estProcheJoueur(zId) != -1) {