Skip to content
Snippets Groups Projects
Commit b169b9be authored by Charlie Darques's avatar Charlie Darques
Browse files

Merge remote-tracking branch 'origin'

parents 3c196715 7ba4f368
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,6 @@ package bitFight;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
public enum Attack implements Action {
PUNCH(10, "punch", ActionHeight.HIGH, 10),
......
......@@ -7,8 +7,13 @@ import java.io.InputStreamReader;
public class Display {
public static Level level;
public static int row = 1;
public Display(Level l){
this.level = l;
}
public static void clearScreen() {
System.out.print("\033[H\033[2J");
}
......@@ -31,15 +36,16 @@ public class Display {
}
public static void goToDialogBox(){
setCursorPos(1,0);
setCursorPos(row+6,0);
//System.out.flush();
}
public static void clearDialogBox(){
clearScreen();
setCursorPos(row, 0);
printDialogBox();
setCursorPos(row,0);
level.displayLifePoints();
goToDialogBox();
}
......@@ -50,7 +56,7 @@ public class Display {
dialogBox = loadTextFile("assets/DialogBox.text");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
e.getMessage();
}
System.out.println(dialogBox);
}
......
......@@ -75,12 +75,18 @@ public class Level{
// affiche la jauge de vie
public void displayLifePoints (){
public void displayLifePoints (){
System.err.println();
System.out.println("\t \t " +this.player.getName());
System.out.println("Player " + this.player.getName());
System.out.println();
System.out.print(Terminal.GREEN+" \t current health "+Terminal.RESET);
for (int indice = 0; indice < ((this.player.getCurrentHealth()/this.player.getMaxHealth())*100)/2; indice ++){
System.out.print(Terminal.GREEN+ "▬"+ Terminal.RESET);
double pourcentage = (this.player.getCurrentHealth()/this.player.getMaxHealth())*100;
for (int indice = 0; indice < pourcentage/2; indice ++){
if (pourcentage<=50){
System.out.print(Terminal.RED+"▬");
}else{
System.out.print(Terminal.GREEN+ "▬"+Terminal.RESET);
}
}
System.out.print(" ");
System.err.println( (int) this.player.getCurrentHealth() + "/" + (int) this.player.getMaxHealth());
......
......@@ -20,6 +20,8 @@ class Main {
Level level = new Level(1, player, enemy);
GameData gamedata = Save.loadObject("res/gamedata");
Display display = new Display(level);
if (gamedata != null) {
player = gamedata.getPlayer();
level = gamedata.getLevelReached();
......
package bitFight;
import java.io.IOException;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment