Skip to content
Snippets Groups Projects
Select Git revision
  • b4b2e01670922ae7963cb69d4afa1b45b68f9e54
  • main default protected
  • 39-retour-utilisateur-sur-le-compteur
3 results

Level.java

Blame
  • Level.java 1.47 KiB
    package bitFight;
    
    import java.util.Scanner;
    
    public class Level{
    
        int nbLevel=1;
        int difficulty=1;
    
        public Level(int nbLevel, int difficulty){
            this.nbLevel=nbLevel;
            this.difficulty=difficulty;
        }
    
        public int getNbLevel() {
            return nbLevel;
        }
    
        public void setNbLevel(int nbLevel) {
            this.nbLevel = nbLevel;
        }
    
        public int getDifficulty() {
            return difficulty;
        }
    
        public void setDifficulty(int difficulty) {
            this.difficulty = difficulty;
        }
    
        public void display() {
            System.out.println("Level " + this.nbLevel);
            System.out.println("Difficulty = " + this.difficulty);
        }
    
        public boolean check() {
            Scanner sc = new Scanner(System.in);
            String c = sc.nextLine();
            if (c == null) {
                sc.close();
                return false;
            }
            sc.close();
            return true;
        }
    
        public void ennemyShowing(Enemy ennemy) {
            System.out.println("An ennemy just appeared : " + ennemy.toString());
        }
    
        public void ennemyDying() {
            System.out.println("The ennemy is dead!");
        }
    
        public void playerDying() {
            
        }
    
        public void fighting(Player p, Enemy ennemy) {
            System.out.println(p.getName() + "'s life : " + p.getCurrentHealth());
            this.ennemyShowing(ennemy);
            System.out.println("Press any key to attack and press enter");
            if (this.check()) {
                this.ennemyDying();
            }
        }
    
    }