So I am trying to make a text adventure game for my computer class. I know the basics of C# but obviously I'm missing something because I can't get the code right. I want to make the man ask the player a question that if they answer no it basically repeats the question because they have to answer yes for the game to continue. I tried using a for loop but that didn't work very well. Anyways, this is the code I have:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("MINECRAFT TEXT ADVENTURE: PART 1!");
Console.WriteLine("\"Hello traveller!\" says a man. \"What's your name?\"");
string playerName = Console.ReadLine();
Console.WriteLine("\"Hi " + playerName + ", welcome to Minecraftia!\nI would give you a tour of our little town but there really isn't much left to\nsee since the attack.\"");
Console.WriteLine("He looks at the stone sword in your hand. \"Could you defeat the zombies in the hills and bring peace to our land?\"");
string answer1 = Console.ReadLine();
if (answer1 == "yes")
{
Console.WriteLine("\"Oh, many thanks to you " + playerName + "!\"");
answerNumber = 2;
}
else if (answer1 == "no")
{
Console.WriteLine("\"Please " + playerName + "! We need your help!\"\n\"Will you help us?\"");
answerNumber = 1;
}
else
{
Console.WriteLine("Pardon me?");
answerNumber = 0;
}
for (int answerNumber = 0; answerNumber < 2;)
{
Console.WriteLine("\"We need your help!\"\n\"Will you help us?\"");
}
}
}
}
Any help or suggestions for what I could do would be greatly appreciated because I've run out of ideas.