예제 #1
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            gameFont = content.Load <SpriteFont>("Fonts/gamefont");

            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            Thread.Sleep(1000);

            // 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();

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = ScreenManager.SpriteBatch;

            // Create and load the level.
            level = new Level(content);

            // Load level and music.
            level.LoadLevel();

            // Create the Shoes.
            shoes = new Shoes(level.getPlayerStartingPosition(), content.Load <Texture2D>("Sprites/Shoes32x48"), Character.State.Idle_Right, 0, 32, 48, 0, spriteBatch, 720, 1280, Keys.W, Keys.A, Keys.S, Keys.D, content);

            // Set the initial position of the player.
            shoes.Position = level.getPlayerStartingPosition();

            // Create the Guy.
            guy = new Guy(content.Load <Texture2D>("Sprites/Guy32x48"), spriteBatch, 0, 0, 32, 48, 720, 1280, content);

            // Load the debug font. We use this for debugging purposes.
            debugFont = content.Load <SpriteFont>("Fonts/debugFont");

            // Loads the sound effects that will be used in the game.
            SoundEffectHandler.LoadSoundEffects(content);

            mouseRect = new Rectangle(Mouse.GetState().X, Mouse.GetState().Y, 16, 16);
        }