Skip to content
Snippets Groups Projects
Commit 4190a0d7 authored by Kellian Mirey's avatar Kellian Mirey
Browse files

Patch healthbar

parent fad0fc7b
Branches
Tags jalon1
No related merge requests found
......@@ -70,4 +70,10 @@ public class Display {
System.out.println(text);
goToUserInput();
}
public static void displayNewHealthBar(){
setCursorPos(row,0);
level.displayLifePoints();
goToUserInput();
}
}
......@@ -89,7 +89,7 @@ public class Level{
}
}
System.out.print(" ");
System.err.println( (int) this.player.getCurrentHealth() + "/" + (int) this.player.getMaxHealth());
System.err.println( (int) this.player.getCurrentHealth() + "/" + (int) this.player.getMaxHealth() + " ");
System.out.print(Terminal.YELLOW+"\t current energy "+Terminal.RESET);
for (int indice = 0; indice < (this.player.getCurrentEnergy())/2; indice ++){
System.out.print(Terminal.YELLOW +"▬"+ Terminal.RESET);
......@@ -100,7 +100,7 @@ public class Level{
public String displayPlayerHealth(){
return (int )this.ennemy.getCurrentHealth() +" / " + (int) this.ennemy.getMaxHealth();
return (int )this.player.getCurrentHealth() +" / " + (int) this.player.getMaxHealth();
}
......
......@@ -94,6 +94,7 @@ class Main {
Display.clearDialogBox();
Attack randomEnemyAttack = Attack.values()[(int) rand.nextDouble()*Attack.values().length];
level.ennemyFaster(randomEnemyAttack);
Display.displayNewHealthBar();
timeBeforeAttack = LocalDateTime.now();
input.newInput();
}
......@@ -138,6 +139,10 @@ class Main {
level.levelGoingUp();
level.displayEndOfLevel();
}
if (player.isDead()){
Display.clearScreen();
level.defeat();
}
if (player.isDead()) {
level.playerDying();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment