- * Text Adventure: Skeleton Code
- * This program provides skeleton code for anyone interested in creating
- * their own text adventure game. Note that this style is not map-based
- * (the user will not be typing n, s, e, or w to walk in certain directions).
- * Instead this is set up as a room-based/linear text adventure game, e.g. you
- * must complete a certain number of tasks and/or have certain items in
- * <p>
- * Map implementation tutorials can be found online if you prefer that style.
- * Enjoy!
- * Functionality to add or improve:
- * -Improve algorithm for printing inventory (use loop)
- * @author
- * @since 2014-01-24
- import java.util.Scanner;
- public class TextAdventure2 {
- /**
- *
- * the command line arguments
- public static void main(String[] args) {
- // Create world
- world.titleScreen();
- // Load room one
- }
- /**
- * <p>
- * This method gets input from user, checks for validity, and formats text.
- * If input is a system command (help, exit, etc.) then input is sent to the
- * <p>
- * @return input
- public static String getInput() {
- // Prompt and read input
- Scanner in = new Scanner(System.in);
- while (inputIsEmptyOrGibberish(input)) {
- input = in.nextLine();
- input = formatInput(input);
- // If system command is typed, send to systemCommandResponses method
- systemCommandResponses(input);
- }
- /**
- * Check if input is empty or gibberish, if so respond with message.
- * This method checks the input for invalid entries and responds with
- * <p>
- * @param input
- * @return true if input is empty or gibberish
- public static boolean inputIsEmptyOrGibberish(String input) {
- // Boolean to check for valid action or system commands
- // If command is valid, input is not empty or gibberish
- && (validActionCommand(input) || validSystemCommand(input))) {
- }
- // Otherwise, provide responses if empty or gibberish
- System.out.println('Cat got your tongue?');
- System.out.println('I don't understand.');
- }
- /**
- * <p>
- * This method formats the user input text by converting to lower case and
- * <p>
- * @param input
- * @return modified/formatted input string
- public static String formatInput(String input) {
- // Convert to lower case
- input = input.replaceAll('s+', ' ');
- }
- /**
- * <p>
- * This method checks that a valid action command (get, open, etc.) was
- * <p>
- * @param input
- * @return true if valid action command
- public static boolean validActionCommand(String input) {
- // Extract command from input (all letters before space)
- input = input.substring(0, input.indexOf(' '));
- boolean check = false;
- if (input.equals('look') || input.equals('get') || input.equals('read')
- || input.equals('close') || input.equals('leave')
- || input.equals('turn') || input.equals('kill')) {
- }
- return check;
- * Check for valid system command, if valid send to system command responses
- * <p>
- * This method checks if a valid system command (exit, help, etc.) was
- * entered by the user. The verb is extracted from the command using
- * <p>
- * @param input
- * @return true if valid system command
- public static boolean validSystemCommand(String input) {
- // Extract command from input (all letters before space)
- input = input.substring(0, input.indexOf(' '));
- boolean check = false;
- if (input.equals('help') || input.equals('inventory')
- || input.equals('load') || input.equals('save')
- || input.equals('restart') || input.equals('quit')
- check = true;
- }
- /**
- * <p>
- * This method provides system responses when the user enters a system
- * <p>
- * @param input
- * @return true if valid system command
- public static void systemCommandResponses(String input) {
- // Display help information
- System.out
- + ' Command syntax: <command>(space)<something>n'
- + ' Action commands: look, open, close, talk, get, move, leaven'
- + ' System commands: help, inventory, load, save, restart, quitn'
- + ' Tips: Typing 'i' is a shortcut to view your inventory');
- else if (input.equals('i') || input.equals('inv')
- World.inventory.print();
- else if (input.equals('exit') || input.equals('quit')) {
- System.exit(0);
- }
- // Player inventory class (add and print)
- ArrayList<String> inv = new ArrayList<String>();
- // Add item to inventory (and print message)
- System.out.println('You pick up the ' + item + '.');
- }
- // Print inventory
- String item;
- if (this.inv.size() 0) {
- }
- item = this.inv.get(i);
- // Convert first letter of each item to upper case
- item = item.substring(0, 1).toUpperCase() + item.substring(1);
- }
- }
- // Print room items
- // Print items in room (figure out a better algorithm using loop)
- if (roomItems.size() > 0) {
- if (roomItems.size() 1) {
- }
- System.out.println(roomItems.get(0) + ' and a '
- }
- System.out.println(roomItems.get(0) + ', '
- + roomItems.get(1) + ' and a ' + roomItems.get(2)
- }
- }
- // Room counter (for tracking events and other usages)
- this.count = this.count + 1;
- System.out.println('Room counter = ' + this.count);
- }
- // Class World contains title screen, introduction, and all rooms
- void titleScreen() {
- System.out.println('+-------------------------------+');
- System.out.println('| Text Adventure: Skeleton Code |');
- System.out.println('+-------------------------------+');
- System.out
- .println('This is skeleton code for a text adventure game.n'
- System.out.println();
- static Inventory inventory = new Inventory();
- // ROOM ONE: The Dark Room - starting point for player
- ArrayList<String> roomOneItems = new ArrayList<String>();
- roomOneItems.add('key');
- // Load room 1 counter and increment room count
- room1Count.increment();
- // Print room 1 description and items in room
- String descriptionRoom = 'You are in a dark room.n';
- RoomItems.print(roomOneItems);
- // Room 1 available actions
- while (true) {
- if (input.equals('look') || input.equals('look room')
- System.out.print(descriptionRoom);
- }
- else if (input.equals('get book')
- roomOneItems.remove('book');
- } else if (input.equals('get book')
- System.out.println('You already have the book.');
- // Get key
- && roomOneItems.contains('key')) {
- this.inventory.add('key');
- && !roomOneItems.contains('key')) {
- }
- // Leave - go to room 2
- this.roomTwo();
- else if (!validSystemCommand(input)) {
- }
- }
- void roomTwo() {
- // Load room 2 items
- ArrayList<String> roomTwoItems = new ArrayList<String>();
- roomTwoItems.add('cell phone');
- // Load room 2 counter and increment room count
- roomCount.increment();
- // Print room 2 description and items in room
- String descriptionRoom = 'You are in the living room.n';
- RoomItems.print(roomTwoItems);
- // Room 2 available actions
- while (true) {
- // Look
- if (input.equals('look') || input.equals('look room')
- System.out.print(descriptionRoom);
- }
- // Get note
- && roomTwoItems.contains('note')) {
- this.inventory.add('note');
- && !roomTwoItems.contains('note')) {
- System.out.println('You already have the note.');
- // Read note
- System.out.println('The note reads, '0614'.');
- else if (input.equals('get cell phone')
- roomTwoItems.remove('cell phone');
- } else if (input.equals('get cell phone')
- System.out.println('You already have the cell phone.');
- else if (!validSystemCommand(input)) {
- }
- }
- }
Best of perman adventure java game download at KeywordSpace(Out of 18 in result | Last check 13 January 2019)
![Game Game](/uploads/1/2/6/2/126259011/667074721.jpeg)
Orcs Elves.jar Pirates Of The Seven Seas.jar Quest For Alliance 2.jar Resident Evil 2.jar Rise Of Lost Empires.jar Robin Hood.jar Scarlottis Mafia Wars 2. Nov 08, 2016 Enjoy fantastic ocean waves and amazing river adventure in Batu Karas. Enjoy fantastic ocean waves and amazing river adventure in Batu Karas! You can surf and river boarding or simply body rafting with quite safety system. The people around the area and nice and very helpful. It is not too far from Pangandaran beach.
Description | Pos. | ||
---|---|---|---|
0 | 1 | ||
0 | 5 | ||
0 | 6 | 6(0) | |
Play Ben 10 games | Power Rangers games | Spiderman games GameGape is the premier games site where you can play over 20,000 free online games including all Ben10, Spiderman, Power Rangers, Mario, Sonic games | 0 | 8 | |
Mobile games. Free download java games for mobile phones. You can find many free java mobile games downloads here. The game catalog is daily updated with top mobile phone games. Download free jar jad games for your phone right now! | 39 | 9 | |
Gamezwap.Net :: Java Games Download For Nokia Samsung Wap.in Games Gameloft games gameswap gamewap Gamezwap.Net::Java Games Download For Nokia Samsung Wap.in Games Gameloft Games gameswap gamewap | 0 | 10 | |
GetJar - Download Free Apps, Games and Themes APK GetJar is the biggest open appstore in the world, currently listing 956000+ apps with more than 3M downloads per day. | 0 | 11 | 11(0) |
0 | 12 | ||
0 | 13 | 13(0) | |
0 | 14 | ||
Google Translate Google's free service instantly translates words, phrases, and web pages between English and over 100 other languages. | 0 | 15 | 15(0) |
0 | 16 | ||
onmedia.tk | 0 | 17 | |
0 | 18 | 18(0) |