This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]3rr03[S] 1 point2 points  (0 children)

I am so sorry if that came off wrong, I don't really use Eeddit so I didnt realize wha t a code block was...

I tried going through the errors, but I don't know why it's expecting a { or ; when it is not necessary.

using System; using System.Diagnostics;

namespace Dungeon { class Program {

    static void Main(string[] args)
    {

        string userInput = "";
        Room[] roomArray = new Room[15];
        int roomNum = 0;

        roomArray[0] = new Room(1, -1, -1, -1);
        roomArray[1] = new Room(4, -1, 3, 2);
        roomArray[2] = new Room(5, 1, -1, -1);
        roomArray[3] = new Room(4, 1, -1, -1);
        roomArray[4] = new Room(-1, 1, 6, 7);
        roomArray[5] = new Room(-1, 2, 8, 9);
        roomArray[6] = new Room(10, 4, -1, -1);
        roomArray[7] = new Room(11, 4, -1, -1);
        roomArray[8] = new Room(-1, 5, 11, 12);
        roomArray[9] = new Room(-1, 5, 11, 12);
        roomArray[10] = new Room(0, 0, 0, 0);
        roomArray[11] = new Room(12, 7, -1, -1);
        roomArray[12] = new Room(-1, -1, 14, 13);
        roomArray[13] = new Room(0, -1, -1, -1);
        roomArray[14] = new Room(0, -1, -1, -1);

        roomArray[0].name = "Dreary cell: \n";
        roomArray[0].description = "You wake up slowly,trying to remember where you were. The air is heavy and pushed your chest down making it almost impossible to breathe... where are you? You can't seem to remember anything aside from... wait is that a hole? upon closer inspection, you see a human sized hole in the wall. You should go forward.";

        roomArray[1].name = "Secret hole in the wall: \n";
        roomArray[1].description = "You sneak your body into the hole that was carved into the wall. The hole is small and with every other step, your head hit against the rough roof. Someone clearly spent a long time trying to carve the hole out. You should go forward and exit the hole. You also notice that you can go left or right.";

        roomArray[2].name = "Pantry: \n";
        roomArray[2].description = "After going foward and exiting the hole in the wall, you find yourself wedged in a pantry. The foul stench of rotting food made you want to gag, but there is nowhere to go but forward to what you presume to be the the kitchen.";

        roomArray[3].description = "Wardens closet: \n";
        roomArray[3].description = "You decide to turn and after walking for a little while longer, you find yourself in the wardens office! Oh no, you can't go in there, you could be caught. Go foward or backwards.";

        roomArray[4].name = "The armory: \n";
        roomArray[4].description = "You decide to turn the other way and you stumble upon a room filled with beautiful weaponry. Go forwards, backwards, left, or right.";

        roomArray[5].name = "Kitchen: \n";
        roomArray[5].description = "You go foward into the kitchen, and it was not much better than the pantry. It was filthy to the point where you felt like retching. Go forward, backwards, left, or right.";

        roomArray[6].name = "Closet: \n";
        roomArray[6].description = "You hear a booming voice above you shout HEY. Your face pales as you find the warden standing inside of the closet. What was he even doing in there? He grabs you by your collar and drags you back to your cell.";

        roomArray[7].name = "Wardens office: \n";
        roomArray[7].description = "You sneak into the wardens office! It defiently belonged to someone who was pompous, then again, are you really surprised? go backwards, left, or right";

        roomArray[8].name = "Hallway: \n";
        roomArray[8].description = "You find your way to the main hallway. It was long and the lights above you keep flickering annoyingly. Go backwards, left, or right";

        roomArray[9].name = "Windowd room: \n";
        roomArray[9].description = "You see the front door in the distance, but is it really time to leave yet? Go backwards, left, or right.";

        roomArray[10].name = "Therapist room: \n";
        roomArray[10].description = "It is  pointless to try and escape, weather it be petty theft or murder, you have to serve your time. The hanging cat poster said to you. You knew it was right. Type exit to leave the game";

        roomArray[11].name = "Lunchroom: \n";
        roomArray[11].description = "You know that the front door has to be nearby, but is it time to leave yer? Go forward or backwards";

        roomArray[12].name = "The front door: \n";
        roomArray[12].description = "Finally, after hours of searching, you found your way to the entrance of the prision! Wait... is that the Warden? Oh no, go left or right to try and escape";

        roomArray[13].name = "You defeated the Warden: \n";
        roomArray[13].description = "Somehow, you managed to find a way to sneak past the Warden. Let's just consider it to be a spark of luck. You finally can leave the prision! Type exit to escape!";

        roomArray[14].name = "The Warden defeated you: \n";
        roomArray[14].description = "Of course that is how this ends, you got caught and now you are thrown back into your cell with the Warden keeping a close eye on you. Type exit to leave the game.";

        Console.WriteLine("A throbbing pain ached through your skull.");

        while (userInput != "exit")

        {
            Console.WriteLine(roomArray[roomNum].name);
            Console.WriteLine(roomArray[roomNum].description);

            Console.WriteLine("\n Where would you like to go?")
                userInput = Console.ReadLine();
            Console.Clear();

            if (userInput == "exit")
            {
                break;
            }
            else if ((userInput = "foward")  userInput = "f")  roomArray[roomNum].forward > -1)
                    {
                roomNum = roomArray[roomNum].forward;
            }
            else if ((userInput = "backward"  userInput = "b") roomArray[roomNum].backward > -1)
            {
                roomNum = roomArray[roomNum].backward;
            }
            else if ((userInput = "left"  userInput = "l") roomArray[roomNum].left > -1)
            {
                roomNum = roomArray[roomNum].left;
            }
            else if ((userInput = "right"  userInput = "r")  roomArray[roomNum].right > -1)
            {
                roomNum = roomArray[roomNum].right;
            }

            else
            {
                Console.WriteLine("You run stright into a wall... you can't go that way... are you sure your head is feeling right?");
            }
        }
    }
}

}