mercredi 6 janvier 2021

Why does 'if' stop music and won't let me play any new musics in it? and how do I make it work?

SoundPlayer player = new SoundPlayer();
player.SoundLocation =  "C:\\Users\\tamar\\Documents\\Visual Studio 2010\\Projects\\The legend of Omoor\\The legend of Omoor\\challenger.wav";

SoundPlayer player2 = new SoundPlayer();
player2.SoundLocation = "C:\\Users\\tamar\\Documents\\Visual Studio 2010\\Projects\\The legend of Omoor\\The legend of Omoor\\challenger.wav";

player.Play();

char a;
Console.WriteLine("Click 'x' to use special move: Arad!");
a = char.Parse(Console.ReadLine());

if (a == 'x')
{
    player2.Play();//that's the part where nothing works, neither the first music, nor the second.
}

the music starts playing after I press "any letter to continue". the problem is that the music stops once I choose x, and it doesn't play the new music that I put in the 'if' too. even without the player2.Play(); in the if, it won't play anything.

Aucun commentaire:

Enregistrer un commentaire