Click here to Skip to main content
15,886,547 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I make a Snake Game using C# in Asp.Net.I want to add Background Sound in the game.How can i Pause the game when the user want

What I have tried:

I am Swap the mp3 sound in the debug folder of a project and try to add by using
System.Media.SoundPlayer track = new System.Media.SoundPlayer(@"E:\Asp\Snake\Snake\bin\Debug\Snake.wav");


but its not working
Posted
Updated 29-Dec-16 10:13am

You're making a game...running on a web server...that doesn't really allow user interaction unless it's through a browser or another application. Think about that.

ASP.NET code runs ENTIRELY server-side. Not one byte of it runs on the client or in the browser. It only "works on your machine" because, when you run the code, your machine is both the server AND the client.

The code you have above will only play sounds on the server, not the client.

So, did you write this game in javascript? I sure hope so.
 
Share this answer
 
I'm Make a Game in Asp.Net Desktop Application.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900