I am a novice programmer that knows a bit but not a lot about c#, regardless I want to use what I knew to make this little console text game as a joke to send to my friends. It has a failure sound effect that uses System.Media.SoundPlayer and from what I know, SoundPlayer needs a path in order to grab a file and play it. It works fine on my computer under the file path "C:\Users\lambk\source\repos\Retarded Game 2022\scare_effectHipitch.wav" (sorry about the project title to anyone offended) but obviously this file path doesn't work for my friends who will download it to their downloads folder and will not be using a user called "lambk". Is there a sort of file path framework that would solve this issue for me? If not then how do people typically circumvent this problem?
Script for reference:
class Program
{
static void Main(string[] args)
{
System.Media.SoundPlayer failureSound = new System.Media.SoundPlayer(@"C:\Users\lambk\source\repos\Retarded Game 2022\scare_effectHipitch.wav");
Console.WriteLine("Guard: Hello Strange Traveler.\n State Your Business In The Motherland.");
Console.WriteLine("\nA) I have come to inaugurate a new king with this dagger!\nB) Seeking Trade Amongst The People, For I Am A Merchant From The B Lands");
string answer = Console.ReadLine();
if (answer == "Seeking Trade Amongst The People, For I Am A Merchant From The B Lands" || answer == "b" || answer == "B")
{
Console.WriteLine("Swell, the motherland may always welcome additional merchendise. \n (you enter the motherland and are greeted with vast stretches of merchendise, selling souvineirs for all the visitors to snag before they leave. You accept this competition wholeheartedly, as you've come to sell not trivial materialistic items, but rather weaponry in the form of bows, arrows, swords, and shields, perhaps also as a souvinier though visitors aren't your core consumers.)\n(you make your way to your new shop)\n");
Console.Read();
}
else
{
failure();
}
//-------VOID CLASSIFICATION-------//
void failure()
{
int counter = 0;
failureSound.PlayLooping();
while (counter < 350)
{
Console.Write("FAILURE_FAILURE_FAILURE_FAILURE_FAILURE_FAILURE_FAILURE_FAILURE_");
Thread.Sleep(1);
counter++;
if (counter == 350)
{
failureSound.Stop();
Console.WriteLine("\nPress Enter To Restart");
Console.Read();
Application.Restart();
}
}
}
//-------VOID CLASSIFICATION-------//
}
}
}