Made a title screen and fixed help command

This commit is contained in:
Luca Carnegie
2019-05-23 13:59:29 -04:00
parent 5a6802679a
commit ba18bed404
3 changed files with 23 additions and 17 deletions

View File

@@ -32,7 +32,6 @@ book, item
socks, item socks, item
painting, item painting, item
inventory, verb inventory, verb
i, verb
notebook, item notebook, item
shaving cream, item shaving cream, item
toothbrush, item toothbrush, item
@@ -46,4 +45,5 @@ chocolate, item
warm bread, item warm bread, item
clothes, item clothes, item
sword, item sword, item
blanket, item blanket, item
die, verb

View File

@@ -130,12 +130,19 @@ class Game {
printWelcome(); printWelcome();
// Enter the main command loop. Here we repeatedly read commands and // Enter the main command loop. Here we repeatedly read commands and
// execute them until the game is over. // execute them until the game is over.
Scanner in = new Scanner(System.in);
boolean finished = false; if(in.nextLine().equals("play")){
while (!finished) { System.out.println("\nType 'help' if you need help, consult the wiki \non GitHub if you are confused and enjoy the game!\n");
Command command = parser.getCommand(); System.out.println("\n\nEscape Casa Loma: A text-based escape game");
finished = processCommand(command); System.out.println("---------------------\n");
System.out.println(currentRoom.longDescription());
boolean finished = false;
while (!finished) {
Command command = parser.getCommand();
finished = processCommand(command);
}
} }
System.out.println("Thank you for playing. Good bye."); System.out.println("Thank you for playing. Good bye.");
} }
@@ -145,9 +152,8 @@ class Game {
private void printWelcome() { private void printWelcome() {
System.out.println("Welcome to ESCAPE CASA LOMA!\n-----"); System.out.println("Welcome to ESCAPE CASA LOMA!\n-----");
System.out.println("A new, fresh take on the escape-room,\nby Johnathon, Luca, Victoria and Evan "); System.out.println("A new, fresh take on the escape-room,\nby Johnathon, Luca, Victoria and Evan ");
System.out.println("\nType 'help' if you need help, consult the wiki \non GitHub if you are confused and enjoy the game!"); System.out.println("Type \"play\" to play the game. If you want to close the game at any time, type \"quit\".");
System.out.println("\n---------------------\n"); System.out.print(">");
System.out.println(currentRoom.longDescription());
} }
/** /**
@@ -173,6 +179,9 @@ class Game {
break; break;
case "quit": case "quit":
return true; return true;
case "die":
System.out.println("If you insist... \n Poof! You're gone. You're out of the castle now, but now a new, grand new adventure begins...");
return true;
case "eat": case "eat":
System.out.println("Do you really think you should be eating at a time like this?"); System.out.println("Do you really think you should be eating at a time like this?");
break; break;
@@ -232,7 +241,7 @@ class Game {
System.out.print(itemsP); System.out.print(itemsP);
System.out.println(); System.out.println();
}else { }else {
System.out.println("You are empty handed."); System.out.println("You have nothing on you. Try and find some items.");
} }
break; break;
case "open": case "open":
@@ -261,10 +270,7 @@ class Game {
* message and a list of the command words. * message and a list of the command words.
*/ */
private void printHelp() { private void printHelp() {
System.out.println("You are lost. You are alone. You wander"); System.out.println("Here's what you can do:");
System.out.println("around at Monash Uni, Peninsula Campus.");
System.out.println();
System.out.println("Your command words are:");
parser.showCommands(); parser.showCommands();
} }
@@ -284,7 +290,7 @@ class Game {
if (nextRoom == null) if (nextRoom == null)
System.out.println("There is no door!"); System.out.println("There is no door!");
else if(nextRoom.getLocked()) { else if(nextRoom.getLocked()) {
System.out.println("The door is locked!"); System.out.println("The door is locked. You need to find a key to open it.");
} }
else { else {
currentRoom = nextRoom; currentRoom = nextRoom;

View File

@@ -1,4 +1,4 @@
package com.bayviewglen.zork; package com.bayviewglen.zork;
public class Zork { public class Zork {
public static void main(String[] args) { public static void main(String[] args) {