Last active
December 1, 2021 13:39
-
-
Save janellbaxter/239dba57c65a379f9f695d5865707d78 to your computer and use it in GitHub Desktop.
9.5 Framework Progress; Programming is Fun: C# Adventure Game (Learn C#)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* [Your Title] | |
* by Your Name, Date | |
* | |
* This work is a derivative of | |
* "C# Adventure Game" by http://programmingisfun.com, used under CC BY. | |
* https://creativecommons.org/licenses/by/4.0/ | |
*/ | |
using System; | |
namespace Adventure | |
{ | |
public static class Game | |
{ | |
static string CharacterName; | |
public static void StartGame() | |
{ | |
GameTitle(); | |
NameCharacter(); | |
Choice(); | |
} | |
static void Choice() | |
{ | |
string input = ""; | |
Console.WriteLine(CharacterName + " which path will you choose? A or B?"); | |
input = Console.ReadLine(); | |
if (input.ToLower() == "a") | |
{ | |
Console.WriteLine("You've chosen path A!"); | |
} | |
else | |
{ | |
Console.WriteLine("You've chosen path B!"); | |
} | |
} | |
static void NameCharacter() | |
{ | |
Console.WriteLine("What would you like your character's name to be?"); | |
CharacterName = Console.ReadLine(); | |
Console.WriteLine("Great! Your Character is now named " + CharacterName); | |
} | |
static void GameTitle() | |
{ | |
string Title = @"Your title here"; | |
Console.Title = Title; | |
Console.ForegroundColor = ConsoleColor.Cyan; | |
Console.WriteLine(Title); | |
Console.ResetColor(); | |
Console.WriteLine("Press enter to start"); | |
Console.ReadKey(); | |
Console.Clear(); | |
} | |
} | |
class Item | |
{ | |
} | |
class Program | |
{ | |
static void Main() | |
{ | |
Game.StartGame(); | |
Console.Read(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment