I started working on an engine to make some text adventure goodness sometime last year but moved on to
something shiny five minutes later. Randomly got the urge to finish it this weekend and figured no reason
not to share the result, if anyone feels like offering crit or improvement suggestions too that'd be just super.
Some of the code is adapted from this tutorial: (Exit.java and Location.java)
http://www.javacoffeebreak.com/text-adv ... index.htmlEverything else is mine.
I've included the source code as well as a sample game I got to working on this afternoon.
I am aware of some issues with the text formatting, and portions of the code are very messy

i'm aware
I need to relegate the code for printing out available exits to a new method, just havn't gotten around to
doing it yet. But if you find any other bugs, shout me.
Also, I can't see to get it to continue reading after a space. For example, with an item name
if the name is "Iron Bar" and I try "pickup Iron Bar" it reads "Iron" and tries to process that,
then does the same with "Bar" instead of taking "Iron Bar" as one input. I've tried scanner.nextLine()
too and that doesnt seem to help.
If anyone wants to use the code, go right ahead, just credit me (Adrian Gordon)
Edit:
Does anyone have a good tutorial on java file i/o? I'd be interested to see if I can make
it read a list of items, locations and worldObjects from a text file instead of instantiating them all
in the Game.java
RE-EDIT:
List of commands:
QUIT, EXPLODE: These quit the game.
COMMANDS, HELP, HOWTOPLAY: These display the available commands.
LOOK, SEE, EXAMINE: These display the current room and available exits.
USE "itemName": Attempts to use the item at the current location (currently, item names are one word only)
PICKUP "itemName": attempts to pick up an item. (i'll add GET too soon, forgot to add it in)
INVENTORY, INV: Displays your inventory
In addition to these, you can type in some other stuff depending on the location, try typing the names of some objects
or details in the scene.
There's a couple more, but they aren't essential to gameplay.