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

Patch healthbar

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