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

            // Set the game font
            gameFont = ScreenManager.Font;

            // Declare a new instance of the enemy match info
            enemyInfo = new EnemyMatchInfo();

            // Load the enemy and player match profiles
            playerMatchImg = content.Load <Texture2D>("JoeYabuki");
            enemyMatchImg  = content.Load <Texture2D>(enemyInfo.MatchImageName);

            // Define the rectangle dimensions
            playerProfileRec = new Rectangle(115, 270, 120, 120);
            enemyProfileRec  = new Rectangle(535, 115, 120, 120);


            // Define the background music and play it
            matchMusic = content.Load <Song>("Audio/Music/Match");
            MediaPlayer.Play(matchMusic);

            // 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();
        }
Beispiel #2
0
        /// <summary>
        /// Load graphics content for the game
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            // Define the fonts
            gameFont  = ScreenManager.Font;
            smallFont = content.Load <SpriteFont>("small");

            // Set the selected move to 0 and match over to false
            selectedMove = 0;
            matchOver    = false;
            playerTurn   = true;

            // Sort and reverse our move array
            Array.Sort(PlayerInfo.Moves);
            Array.Reverse(PlayerInfo.Moves);

            // Iterate over each of the moves
            foreach (int move in PlayerInfo.Moves)
            {
                // Because our array is now sorted by descending order, whenver we hit the first -1,
                // we know that the following elements are less than or equal to -1, meaning they are
                // unusuable. We can ignore the rest because they do not count as moves
                if (move == -1)
                {
                    break;
                }

                // Increment the maximum numer of moves
                maxMoves++;
            }

            // Load the background and move select foreground image
            backgroundImg = content.Load <Texture2D>("Images/Backgrounds/GameplayBackground");
            moveSelectImg = content.Load <Texture2D>("Images/Sprites/MoveSelectScreen");

            playerHealthBarImg = content.Load <Texture2D>("Images/Sprites/PlayerHealthBar");

            // Define the dimensions of the fullscreen rectangle
            fullScreenRec      = new Rectangle(0, 0, BufferWidth, BufferHeight);
            playerHealthBarRec = new Rectangle(85, 30, playerHealthBarImg.Width, playerHealthBarImg.Height);

            // Initialize the player, enemy and enemy match info
            player         = new Player(content);
            enemy          = new Enemy();
            enemyMatchInfo = new EnemyMatchInfo();

            // Initialize the enemy and player sprite managers
            enemySpriteManager  = new EnemySpriteManager(content, new Vector2(340, 60), enemyMatchInfo.FirstName);
            playerSpriteManager = new PlayerSpriteManager(content, new Vector2(360, 200));

            // Define and play the background track corresponding to the correct opponent
            track = content.Load <Song>($"Audio/Music/BattleThemes/{enemyMatchInfo.FirstName}");
            MediaPlayer.Play(track);

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