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; package bitFight;
import java.io.IOException;
public interface Display { public interface Display {
public void display(); public void display();
public boolean validate(); public void validate() throws IOException ;
} }
package bitFight; package bitFight;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner; import java.util.Scanner;
...@@ -17,15 +20,15 @@ public class GameDisplay implements Display{ ...@@ -17,15 +20,15 @@ public class GameDisplay implements Display{
} }
@Override @Override
public boolean validate() { public void validate() throws IOException {
Scanner sc= new Scanner(System.in); BufferedReader br= new BufferedReader( new InputStreamReader(System.in));
String c= sc.nextLine(); char c= (char)br.read();
if(c== null){ char enter='\n';
sc.close(); if(c==enter){
return false; 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; ...@@ -2,8 +2,8 @@ package bitFight;
public class Level{ public class Level{
int nbLevel=1; int nbLevel;
int difficulty=1; int difficulty;
public Level(int nbLevel, int difficulty){ public Level(int nbLevel, int difficulty){
this.nbLevel=nbLevel; this.nbLevel=nbLevel;
......
package bitFight; package bitFight;
import java.sql.Date; import java.io.IOException;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Random; import java.util.Random;
import java.util.Scanner; import java.util.Scanner;
class Main { 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); Scanner in = new Scanner(System.in);
Random rand = new Random(); Random rand = new Random();
...@@ -48,5 +54,4 @@ class Main { ...@@ -48,5 +54,4 @@ class Main {
in.close(); in.close();
} }
} }
package bitFight; package bitFight;
import java.util.Scanner; import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Menu implements Display{ public class Menu implements Display{
...@@ -14,19 +16,21 @@ public class Menu implements Display{ ...@@ -14,19 +16,21 @@ public class Menu implements Display{
} }
public void display(){ public void display(){
System.out.println(this.titre); System.out.println('\n');
System.out.println(this.texte); System.out.println(" BitFight "+'\n');
System.out.println(" Welcome to BitFight, a combat game. Press enter to continue"+'\n');
} }
public boolean validate(){ public void validate() throws IOException {
Scanner sc= new Scanner(System.in); BufferedReader br= new BufferedReader( new InputStreamReader(System.in));
String c= sc.nextLine(); char c= (char)br.read();
if(c== null){ char enter='\n';
sc.close(); if(c==enter){
return false; 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