Friday, February 3, 2023

TextBasedAdventure

 My current text for my textbasedadventure game currently in progress



https://uxbridgecollegeacuk-my.sharepoint.com/:t:/g/personal/40185484_hcuc_ac_uk/EQwqklqSsGZGv3n3GMGCdIwBqSsc8Pof94tpWHFROWg6mA


using System;
using System.Collections.Generic;
using System.Linq;
namespace textbasedgame
{
    class Program
    {
        static bool isRunning;
        static List<string> Inventory = new List<string>();

 

        public struct Entity
        {
            public int health;
        }

 

        static Entity player = new Entity();
        static Entity ogre = new Entity();

 

        static void _Init()
        {
            isRunning = true;

 


            player.health = 15;
            ogre.health = 10;
        }
        static void StartMenu()
        {
            Console.WriteLine("Welcome to the game!\n" + "Select an option:\n" + "1.Start the game \n" + "2. Exit");
            Console.Write(">");
            string choice = Console.ReadLine().ToLower();
            if (choice == "1" || choice == "start")
            {
                Room1();
            }
            else if (choice == "2" || choice == "exit")
            {
                isRunning = false;
            }
            else
            {
                Console.WriteLine("Incorrect Entry! Please press 1 or 2");
            }
        }
        static void Room1()
        {           //Room1
            Console.WriteLine("You a trapped in a dungon eliminate all enemies to get out alive");
            Console.WriteLine("1. Do you go to the right?. \n" + "2. Do you go downwards?. \n");
            Console.Write(">");
            string choice = Console.ReadLine().ToLower();
            if (choice == "1")
            {
                Room2();
            }
            else if (choice == "2")
            {
                // choice //Room 2
                Console.WriteLine("There are two doors ahead of you do you take the left or the right?");
                Console.WriteLine("1.Right. \n" + "2.Left. \n");
                string choice1 = Console.ReadLine().ToLower();
                if (choice == "1")
                {
                    // choice 2
                    Console.WriteLine("You are dead");
                    Room1();
                }
                else if (choice == "2")
                {
                    Room2();
                }
                {
                    // choice 1
                    Console.WriteLine("You Picked Correctly and are in a treasure room with a shop. \n");
                    Console.WriteLine("1.Continue on. \n" + "2. Shop for Items. \n ");

 

                }
            }
        }
        static void Room2()
        {       //Room3
            Console.WriteLine("There are two doors ahead of you do you take the left or the right?");
            Console.WriteLine("1.Right. \n" + "2.Left. \n");
            string choice = Console.ReadLine().ToLower();
            if (choice == "2")
            {
                // choice 1
                Console.WriteLine("You are dead");
                Room1();
            }
            else if (choice == "1")
            {
                // choice 2
                Console.WriteLine("You Picked Correctly and are in a treasure room with a shop. \n");
                Console.WriteLine("1.Continue on. \n" + "2. Shop for Items. \n ");
            }
        }
        static void Room3()
        {        //Room4
            Console.WriteLine("You Picked Correctly and are in a treasure room with a shop. \n");
            Console.WriteLine("1.Continue on. \n" + "2. Shop for Items. \n ");
            string choice = Console.ReadLine().ToLower();
            if (choice == "1")
            {
                //choice 1
                Console.WriteLine("1. Do you go to the right?. \n" + "2. Do you go downwards?. \n");
                string choice4 = Console.ReadLine().ToLower();
                if (choice == "1")
                {
                 Console.WriteLine("You have encountered . \n");

 


                }
            }
            else if (choice == "2")
            {
                Console.WriteLine("You have 350 gold");
                Console.WriteLine("1.upgrade sword to level 2 ($150) . \n" + "2.upgrade Bow to level 2 ($100) . \n");
                string choice5 = Console.ReadLine().ToLower();

 


            }
        }
        static void Main(string[] args)
        {
            _Init();
            while (isRunning == true)
            {
                StartMenu();
            }
        }
    }
}

No comments:

Post a Comment

3D Maya Themed Diorama

This is my themed diorama work I did a campsite kind of thing with a caravan, a tent, bushes, rocks, trees and fences. I wanted to this mode...