Modified prototype view class 'GameDisplay'

main
mike 2023-03-24 13:09:00 -04:00
parent 9325ab21ad
commit fdb6a98b13
2 changed files with 8 additions and 4 deletions

View File

@ -146,7 +146,6 @@ public class GameEngine<T> implements Runnable {
view.printVillageState(this.map,"Current Village State"); view.printVillageState(this.map,"Current Village State");
view.printGameMenu(); view.printGameMenu();
System.out.println();
Map exploringMap = null; Map exploringMap = null;
boolean deleteMyHeart = true; boolean deleteMyHeart = true;
while (running) { while (running) {
@ -158,8 +157,8 @@ public class GameEngine<T> implements Runnable {
try { try {
if ((in = view.nextInput()) != null) { if ((in = view.nextInput()) != null) {
String[] args = in.split(" "); String[] args = in.split(" ");
System.out.println("Your Input: ");
System.out.println("\t->" + in + '\n'); view.printLastInput();
// reset the map if they aren't exploring // reset the map if they aren't exploring
if (in.charAt(0) != '4') if (in.charAt(0) != '4')
deleteMyHeart = true; deleteMyHeart = true;

View File

@ -22,10 +22,15 @@ public class GameDisplay {
public String nextInput() throws IOException { public String nextInput() throws IOException {
if (reader.ready()) { if (reader.ready()) {
return scanner.nextLine(); return (input = scanner.nextLine());
} else return null; } else return null;
} }
public void printLastInput() {
System.out.println("\nYour Input: ");
System.out.println("\t->" + input + '\n');
}
public void printVillageState(Map map, String displayName) { public void printVillageState(Map map, String displayName) {
Print resourcesPrinter = new Print(displayName, 2); Print resourcesPrinter = new Print(displayName, 2);