C
C#14mo ago
shuffle

Text based game assignment

Hey im fairly new to c sharp and we have began learning it in school. We have been set an assignment to create a text based adventure game. I am currently looking to create a room with a puzzle in that requires the user to navigate an object one square at a time around the room with obstacles in it to open a chest
No description
1 Reply
shuffle
shuffleOP14mo ago
this is the code i have worked together so far and im not sure where to go from here tbh as im not sure how classes work and how to use coordinate tracking with 2d arrays so if any tutorials that teach 2d array coordinate tracking would be useful or any kind of useful articleds or just help 🙂 would be appreciated
public static void door13Puzzle()
{

//int locationy;
//int locationx;



string[,] map =
{
{ "┌", "─", "─", "─", "─", "─", "─", "─", "─", "┐"},
{ "│", "x", "0", "0", "0", "0", "0", "0", "0", "│"},
{ "│", "x", "0", "x", "x", "x", "x", "x", "0", "│"},
{ "│", "o", "0", "x", "0", "0", "0", "x", "0", "│"},
{ "│", "x", "x", "x", "0", "x", "0", "x", "0", "│"},
{ "│", "x", "x", "x", "0", "x", "0", "x", "0", "│"},
{ "│", "█", "0", "0", "0", "x", "0", "0", "0", "│"},
{ "└", "─", "─", "─", "─", "─", "─", "─", "─", "┘"}
};

Console.Clear();
Console.WriteLine("You look around the room and create a mental image of the puzzle.\n");
Thread.Sleep(2000);
Console.Clear();
Console.WriteLine("\n");

for (int i = 0; i < map.GetLength(0); i++)
{
for (int j = 0; j < map.GetLength(1); j++)
{
Console.Write(map[i, j]);
}
Console.WriteLine();
}
}
public static void door13Puzzle()
{

//int locationy;
//int locationx;



string[,] map =
{
{ "┌", "─", "─", "─", "─", "─", "─", "─", "─", "┐"},
{ "│", "x", "0", "0", "0", "0", "0", "0", "0", "│"},
{ "│", "x", "0", "x", "x", "x", "x", "x", "0", "│"},
{ "│", "o", "0", "x", "0", "0", "0", "x", "0", "│"},
{ "│", "x", "x", "x", "0", "x", "0", "x", "0", "│"},
{ "│", "x", "x", "x", "0", "x", "0", "x", "0", "│"},
{ "│", "█", "0", "0", "0", "x", "0", "0", "0", "│"},
{ "└", "─", "─", "─", "─", "─", "─", "─", "─", "┘"}
};

Console.Clear();
Console.WriteLine("You look around the room and create a mental image of the puzzle.\n");
Thread.Sleep(2000);
Console.Clear();
Console.WriteLine("\n");

for (int i = 0; i < map.GetLength(0); i++)
{
for (int j = 0; j < map.GetLength(1); j++)
{
Console.Write(map[i, j]);
}
Console.WriteLine();
}
}
Want results from more Discord servers?
Add your server