using System;
using System.Collections.Generic;
using System.Linq;
namespace textbasedgame
{
class Program
{
static bool isRunning;
static void _Init()
{
isRunning = true;
}
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()
{ //Start Room
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 1
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 1
Console.WriteLine("You are dead");
Room1();
}
else if (choice == "2")
{
// choice 2 //Room 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 ");
string choice6 = Console.ReadLine().ToLower();
if (choice == "1")
Room2();
}
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();
if (choice == "1")
{
// choice 1
Console.WriteLine("You now have sword level 2 .You have $200. \n");
Room3();
}
else if (choice == "2")
{
// choice 2
Console.WriteLine("You now have Bow level 2 . You have $250. \n");
Room3();
}
// choice //Room 3
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 choice7 = Console.ReadLine().ToLower();
if (choice == "1")
{
// choice //Room 1
Console.WriteLine("There are ");
Console.WriteLine("1.Right. \n" + "2.Left. \n");
}
}
else if (choice == "2")
{ //Room4
Console.WriteLine("You have encountered an enemy what do you choose to do . \n");
Console.WriteLine("1. Do you use a sword?. \n" + "2. Do you use a bow?. \n");
string choice8 = Console.ReadLine().ToLower();
if (choice == "1")
{
// choice 1
Console.WriteLine("Your attack was very effective . \n");
Console.WriteLine("Your attack eliminated the monster . \n");
Room4();
}
else if (choice == "2")
{
//choice 2
Console.WriteLine("Your attack was not very effective what do you do now. \n");
Console.WriteLine("1.Attack again. \n" + "2. Defend . \n ");
if (choice == "1")
{
// choice 1
Console.WriteLine("Your attack was effective . \n");
Console.WriteLine("You were attacked and now badly hurt . \n");
}
else if (choice == "2")
{
// choice 2
Console.WriteLine("You Defended from a attack . \n");
Console.WriteLine("You are hurt but will be fine . \n");
Console.WriteLine("1.Attack again. \n" + "2. Defend . \n ");
if (choice == "1")
{
// choice 1
Console.WriteLine("Your attack was very effective . \n");
Console.WriteLine("Your attack eliminated the monster . \n");
}
}
else if (choice == "2")
{
Console.WriteLine("You Defended from a attack . \n");
Console.WriteLine("You couldnt deal with the pain and died");
Room1();
}
}
}
}
}
static void Room4()
{
//room 9
Console.WriteLine("There seems to be a trap room with 2 options to live");
Console.WriteLine("1.Run to the left . \n" + "2.Run to the right. \n");
string choice = Console.ReadLine().ToLower();
if (choice == "1")
{
Console.WriteLine("Spikes have shot up and shot right through you and you are dead");
Room1();
}
else if (choice == "2")
{
Console.WriteLine("Spikes have shot up and you picked the correct side well done");
}
}
static void Room2()
{ //Room 4
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")
Room3();
}
static void Room3()
{ //Room5
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
//room 6
Console.WriteLine("1. Do you go to the right?. \n" + "2. Do you go downwards?. \n");
string choice4 = Console.ReadLine().ToLower();
if (choice == "1")
{ //Room 7
Console.WriteLine("You have encountered an enemy what do you choose to do . \n");
Console.WriteLine("1. Do you use a sword?. \n" + "2. Do you use a bow?. \n");
string choice5 = Console.ReadLine().ToLower();
if (choice == "1")
{
// choice 1
Console.WriteLine("The enemy has blocked the attack and hit you back, do you. \n");
Console.WriteLine("1.Attack again. \n" + "2. Defend . \n ");
string choice6 = Console.ReadLine().ToLower();
if (choice == "1")
{
Console.WriteLine("You hit a crit attack and the enemy has fallen well done. \n");
//final room
Room5();
}
else if (choice == "2")
{
Console.WriteLine("You have fallen and have surrendered. \n");
Room1();
}
}
else if (choice == "2")
{
Console.WriteLine("The enemy was to strong and the bow did nothing and he snapped your neck. \n");
Room1();
}
}
else if (choice == "2")
{
//final room
Room5();
}
//final room
static void Room5()
{
Console.WriteLine("There seems to be a trap room with 2 options to live");
Console.WriteLine("1.Run to the left . \n" + "2.Run to the right. \n");
string choice = Console.ReadLine().ToLower();
if (choice == "1")
{
Console.WriteLine("The spikes are shooting up and the wall is srinking do you");
Console.WriteLine("1.stay to the left side and lay on the floor and hope . \n" + "2.Run to the right side and lay there instead. \n");
if (choice == "1")
{
Console.WriteLine("Well done you have won the game");
Room1();
}
else if (choice == "2")
{
Console.WriteLine("You should have stayed and now you are dead");
Room1();
}
}
else if (choice == "2")
{
Console.WriteLine("You have died");
Room1();
}
}
}
else if (choice == "2")
{ //Room8
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();
if (choice == "1")
{
// choice 1
Console.WriteLine("You now have sword level 2 .You have $200. \n");
}
else if (choice == "2")
{
// choice 2
Console.WriteLine("You now have Bow level 2 . You have $250. \n");
}
}
}
static void Main(string[] args)
{
_Init();
while (isRunning == true)
{
StartMenu();
}
}
}
}
No comments:
Post a Comment