Beispiel #1
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            ScreenBoundary = new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height);
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }
            dbConn = new DbConn();                                    //CREATES THE DATABASSE CONNECTION OBJECT
            dbConn.loadDb(gamemode);                                  //LOADS TEH DATABASAE FOR THIS MODE

            gameFont = content.Load <SpriteFont>("quartz4");          // loads the font which will be used throughout the game
            Texture2D battexture  = content.Load <Texture2D>("bat");  // loads the texture of the batt
            Texture2D balltexture = content.Load <Texture2D>("ball"); // loads the texture of the ball

            brickImage = content.Load <Texture2D>("brick");           //loads the texture of the brick
            P1bat      = new Bat(battexture, ScreenBoundary);         //creats a new bat object called P1bat
            ball       = new Ball(balltexture, ScreenBoundary);       //creates a new ball object
            P2bat      = new Bat(battexture, ScreenBoundary);         //creates a new object called p2bat
            StartGame();                                              //STARTS THE GAME

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }