//print the buffer with no prompt:
 public static void prompt()
 {
     Console.Clear();
     Console.Write(Game_Utilities.wrap(output_buffer, Console.WindowWidth));
     Console.Write(">");
     output_buffer = ""; // clear the buffer when done.
 }
 // print the buffer
 public static void print()
 {
     Console.Clear();
     //wrap the text to fit onto the screen correctly
     Console.Write(Game_Utilities.wrap(output_buffer, Console.WindowWidth));
     Console.WriteLine("What would you like to do?");
     Console.Write(">");
     output_buffer = ""; // clear the buffer when done.
 }
        public static void end_game(string endText)
        {
            Program.quit = true;
            Console.Clear();
            Console.WriteLine(Game_Utilities.wrap(endText, Console.WindowWidth));

            //force to close window after game ends...
            Console.WriteLine("You may now close this window.");
            Console.CursorVisible = false;
            //infanite loop so no action can be taken...
            while (true)
            {
                Console.ReadKey(true);
            }
        }
        //Welcone Screen
        public static void title_screen()
        {
            Console.Clear();
            Console.WriteLine();
            Console.WriteLine(Game_Utilities.wrap("*** Welcome to Generic Adventure Time!" +
                                                  " A gaming experiment by Jeff Heytow, novice programmer. ***",
                                                  Console.WindowWidth));
            Console.WriteLine(Game_Utilities.wrap("\n\nPlease note that you can type 'help' " +
                                                  "at any time to see a list of available commands.", Console.WindowWidth));
            Console.WriteLine("\nPress any key to begin...");

            Console.CursorVisible = false; //get rid of the cursor
            Console.ReadKey();
            Console.CursorVisible = true;  // bring cursor back		this.room_enemies	Keyword 'this' is not valid in a static property, static method, or static field initializer

            Console.Clear();
        }
Exemple #5
0
        // determine what action to take based
        // on the user input
        public static void process(string input)
        {
            // get the first half and trim it to one easy to read command
            string command = Game_Utilities.extract_command(input.Trim().Trim().ToLower());
            // get the second half and trim it to one easy to read command
            string action = Game_Utilities.extract_action(input.Trim().Trim().ToLower());

            string direction = Game_Manager.enemy.npc_direction();


            // now take action based on the input given:

            /*
             * user commands are:
             * ~ move       - moves the player
             * ~ look       - describes the current area
             * ~ take       - takes an object from the area
             * ~ stats      - displays the Player's current stats
             * ~ drop       - drops an object from the area
             * ~ inventory  - lists the player's inventory items
             * ~ help       - displays the list of user commands
             * ~ quit       - exits the game
             */
            switch (command)
            {
            case "move":
                Player.move(action);
                Text_Buffer.Add("\nYou are located at [ " + Player._Player._X_Position +
                                ", " + Player._Player._Y_Position + " ]");
                break;

            case "battlecry":
                Player._Player.BattleCry();
                break;

            case "look":
                Player.get_room().describe();
                break;

            case "take":
                Player.pickup_item(action);
                break;

            case "drop":
                Player.drop_item(action);
                break;

            case "stats":
                Player.stats();
                break;

            case "inventory":
                Player.print_inventory();
                break;

            case "help":
                help_screen();
                break;

            case "quit":
                Program.quit = true;
                return;
            }

            process_enemy(direction);
            Game_Manager.check_game_rules();
            Text_Buffer.print();
        }