Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Help please! I need to make a text base game for my class

$
0
0

I need help for my game programming class. I have to create a text base game. Here is my requirements.

For your Final Project you will be taking everything that you have learned this semester and apply it to a game. You will be creating a text based Adventure game, it can be a Haunted House, a Dangerous Dungeon, or wherever your imagination takes you. It will need to have the following:

  • A Minimum of 10 rooms/areas to explore.
  • Ask the player his/her name, and use it in the input prompt (Ex. "Fred, where do you want to go?").
  • When the player "looks" a description of the area will print out.
  • A game loop that drives the game.
  • At least 2 Class files.
  • An Array to hold the rooms/areas.
  • Players will need to be able to go North, South, East, West (Up, Down, Left, Right if you prefer). If the player cannot go that direction, a message needs to tell him that.
  • Have a "I do not understand that" message of some kind for invalid input.

The Final Project Example will give you an idea of what you are looking for, keep in mind however it has less than half the rooms you need for your project, but the basic functionality is there.

So far this is what I have

Program:

           

{
    class Program
    {
        static void Main(string[] args)
        {
            Game run = new Game();

            run.Start();

            Console.ReadLine();



        }
    }
}

Game:

class Game:Room
    {
        public string input;

        public void Start()
        {
            Room[] rooms = new Room[10];

            rooms[0] = new Room("Hall", "You are in the hallway", -1, -1, 2, 1);
            rooms[1] = new Room("Living room", "You are in the you are in the living room", -1, -1, 2, 1);
            rooms[2] = new Room("Kitchen", "You are in the kitchen,", -1, -1, 2, 1);
            rooms[3] = new Room("bathroom", "You are in the bathroom", -1, -1, 2, 1);
            rooms[4] = new Room("Bedroom", "You are in the bedroom", -1, -1, 2, 1);
            rooms[5] = new Room("Attic", "you are in the attic", -1, -1, 2, 1);
            rooms[6] = new Room("Pool", " You are in the pool area", -1, -1, 2, 1);
            rooms[7] = new Room("Indoor Garden", "You are in the indoor garden", -1, -1, 2, 1);
            rooms[8] = new Room("Basement", "You are in the basement", -1, -1, 2, 1);
            rooms[9] = new Room("Dungeon", "You are in the dungeon", -1, -1, 2, 1);
            input = Console.ReadLine();

            int dir = 0;

            while (input != "quit")
            {
                Console.WriteLine(rooms[dir].rmName + "\n" + rooms[dir].rmDesc);
                Console.ReadLine();

                if (input == "up" && rooms[dir].up > -1)
                {
                    dir = rooms[dir].up;
                }

                if (input == "quit")
                {
                    input = "quit";
                }
            }


        }
    }
}

Room:

class Room
    {

        public string rmName;
        public string rmDesc;


        public int up = -1;
        public int down = -1;
        public int left = -1;
        public int right = -1;

        public Room()
        {

        }


        public Room(string nm, string desc, int u, int d, int l, int r)
        {
            rmName = nm;
            rmDesc = desc;
            up = u;
            down = d;
            right = r;
            left = l;

        }

    }
}

Can someone help with what to do next?

Thank you!


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>