Example #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Example #2
0
        public void playBackgroundSound(Game1.GameState screen)
        {
            switch (screen)
            {
                case Game1.GameState.start:
                    if (backgroundInstance == null)
                    {   // for seamless audio transitions between menu screens

                        backgroundInstance = backgroundTitle.CreateInstance();
                        backgroundInstance.IsLooped = true;
                        if (musicOn == true)
                        {
                            if (backgroundInstance.State != SoundState.Playing)
                            {

                                backgroundInstance.Play();
                            }
                        }
                    }

                    break;
                case Game1.GameState.help:

                    break;
                case Game1.GameState.options:

                    break;
                case Game1.GameState.credits:

                    break;
                case Game1.GameState.game:
                    if (backgroundInstance != null)
                    {
                        backgroundInstance.Stop();//ensures only 1 instance is playing at a time
                    }
                    backgroundInstance = backgroundPlay.CreateInstance();//different background Music
                    backgroundInstance.IsLooped = true;
                    if (musicOn == true && backgroundInstance.State != SoundState.Playing)
                    {

                            backgroundInstance.Play();

                    }
                    break;

            }
        }
Example #3
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     instance = this;
 }