Skip to content
Snippets Groups Projects
Commit 222d0fba authored by Jeyda Parlar's avatar Jeyda Parlar :hibiscus:
Browse files

maj affichage

parent d5b0f8b1
No related branches found
No related tags found
No related merge requests found
package bitFight;
import java.io.IOException;
public interface Display {
public void display();
public boolean validate();
public void validate() throws IOException ;
}
package bitFight;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
......@@ -17,15 +20,15 @@ public class GameDisplay implements Display{
}
@Override
public boolean validate() {
Scanner sc= new Scanner(System.in);
String c= sc.nextLine();
if(c== null){
sc.close();
return false;
public void validate() throws IOException {
BufferedReader br= new BufferedReader( new InputStreamReader(System.in));
char c= (char)br.read();
char enter='\n';
if(c==enter){
System.out.print("\033[H\033[2J");
System.out.flush();
br.close();
}
sc.close();
return true;
}
}
\ No newline at end of file
package bitFight;
public class GamePlay{
Level level= new Level(1,1);
Player player= new Player("Java");
Enemy enemy= new Enemy(1);
}
\ No newline at end of file
......@@ -2,8 +2,8 @@ package bitFight;
public class Level{
int nbLevel=1;
int difficulty=1;
int nbLevel;
int difficulty;
public Level(int nbLevel, int difficulty){
this.nbLevel=nbLevel;
......
package bitFight;
import java.sql.Date;
import java.io.IOException;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Random;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
public static void main(String[] args) throws IOException{
Menu menu= new Menu(" "," ");
menu.display();
menu.validate();
Scanner in = new Scanner(System.in);
Random rand = new Random();
......@@ -48,5 +54,4 @@ class Main {
in.close();
}
}
package bitFight;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Menu implements Display{
......@@ -14,19 +16,21 @@ public class Menu implements Display{
}
public void display(){
System.out.println(this.titre);
System.out.println(this.texte);
System.out.println('\n');
System.out.println(" BitFight "+'\n');
System.out.println(" Welcome to BitFight, a combat game. Press enter to continue"+'\n');
}
public boolean validate(){
Scanner sc= new Scanner(System.in);
String c= sc.nextLine();
if(c== null){
sc.close();
return false;
public void validate() throws IOException {
BufferedReader br= new BufferedReader( new InputStreamReader(System.in));
char c= (char)br.read();
char enter='\n';
if(c==enter){
System.out.print("\033[H\033[2J");
System.out.flush();
br.close();
}
sc.close();
return true;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment