/// <summary>
 /// Constructs new Player object from PlayerData structure, a texture to represent it, and a texture to represent its projectiles
 /// </summary>
 /// <param name="d">PlayerData structure which is loaded from an XML file through the ContentPipeline of the main game</param>
 /// <param name="tex">Texture to represent the player</param>
 /// <param name="cBTex">Texture to represent the player's projectiles</param>
 public Player(PlayerData d, Texture2D tex, Texture2D cBTex)
     : base(d, tex, cBTex)
 {
     abilityActivateTime = abilityRechargeStartTime = TimeSpan.Zero;
     ABILITY_DURATION = d.ABILITY_DURATION;
     ABILITY_RECHARGE_MAX = d.ABILITY_RECHARGE_MAX;
     shipState = ShipState.AbilityRecharging;
 }
 public Player_ManOfWar(PlayerData d, Texture2D tex, Texture2D cBTex)
     : base(d,tex,cBTex)
 {
 }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            graphics.PreferredBackBufferHeight = (graphics.GraphicsDevice.DisplayMode.Height - (graphics.GraphicsDevice.DisplayMode.Height / 9));
            graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.DisplayMode.Width - (graphics.GraphicsDevice.DisplayMode.Width / 7);
            graphics.ApplyChanges();

            #region Textures
            playerBrig = Content.Load<Texture2D>("PlayerImages/Brig2_1");
            playerFrigate = Content.Load<Texture2D>("PlayerImages/Frigate");
            playerManOfWar = Content.Load<Texture2D>("PlayerImages/ManOfWar");
            enemyBrig = Content.Load<Texture2D>("EnemyImages/Brig2_1 - Enemy");
            enemyFireBoat = Content.Load<Texture2D>("EnemyImages/FireBoat");
            enemyFrigate = Content.Load<Texture2D>("EnemyImages/Frigate - Enemy");
            enemyManOfWar = Content.Load<Texture2D>("EnemyImages/ManOfWar - Enemy");
            healthPowerup = Content.Load<Texture2D>("HealthPowerup");
            BossTexture = Content.Load<Texture2D>("EnemyImages/Boss");
            #endregion

            BOSS_POSITION = new Vector2(BossTexture.Width / 2, graphics.PreferredBackBufferHeight / 2 - BossTexture.Height / 2);

            #region Main Menu
            logo = Content.Load<Texture2D>("BeardCoded2_1");
            logoFont = Content.Load<SpriteFont>("Fonts/LogoFont");
            mottoFont = Content.Load<SpriteFont>("Fonts/MottoFont");

            #endregion

            #region GameMaterial
            // Create a new SpriteBatch, which can be used to draw textures.
            // player = new Player_Brig(Content);
            //player = new Player_Frigate(Content);
            playerStartingPos = new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2);
            EnemyList = new List<Enemy>();
            spriteBatch = new SpriteBatch(GraphicsDevice);
            playerInteractableList = new List<PlayerInteractable>();
            friendlyList = new List<FriendlyShips>();

            //load player ship textures
            playerCBTexture = Content.Load<Texture2D>("CannonBall");
            enemyCBTexture = Content.Load<Texture2D>("CannonBall_Enemy");
            playerCBPowerUpTexture = Content.Load<Texture2D>("CannonBall_PowerUp");
            //Load HUD
            HUDFont = Content.Load<SpriteFont>("Fonts/HUDFont");
            healthBar = Content.Load<Texture2D>("healthBar");
            multiplierTexture = Content.Load<Texture2D>("Multiplier");
            #endregion

            #region Time Variables
            #endregion

            //Load object data
            #region ObjectData
            PLAYER_BRIG_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player/Player_BrigData");
            PLAYER_FRIG_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player/Player_FrigateData");
            PLAYER_MOW_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player/Player_ManOfWarData");

            FIREBOAT_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/FireboatData");
            ENEMY_BRIG_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/Enemy_BrigData");
            ENEMY_FRIG_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/Enemy_FrigateData");
            ENEMY_MOW_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/Enemy_ManOfWarData");

            FRIENDLY_SHIPS_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/FriendlyShipsData");

            BOSS_DATA = Content.Load<EnemyData>("ObjectDataFiles/AI/BossData");

            HEALTH_POWER_DATA = Content.Load<PlayerInteractableData>("ObjectDataFiles/PlayerInteractables/HealthPowerupData");
            MULTIPLIER_DATA = Content.Load<PlayerInteractableData>("ObjectDataFiles/PlayerInteractables/MultiplierData");
            #endregion

            #region Sounds
            //load songs from folder and put in list
            BackgroundSongs = new List<Song>();
            //main menu theme
            mainMenuSong = Content.Load<SoundEffect>("Sounds/PirateWarsMainMenu");
            mainMenuSongInstance = mainMenuSong.CreateInstance();
            mainMenuSongInstance.IsLooped = true;
            //game music
            gameSong = Content.Load<SoundEffect>("Sounds/GIOmetryWars");
            gameSongInstance = gameSong.CreateInstance();
            gameSongInstance.IsLooped = true;
            //game over
            gameOverSong = Content.Load<SoundEffect>("Sounds/GameOver");
            gameOverSongInstance = gameOverSong.CreateInstance();
            #endregion

            #region Menus

            //General buttons
            startButtonPos = new Vector2(300, 300);
            startButton = new GameButton(Content.Load<Texture2D>("StartButton"), startButtonPos);
            returnToMenu = new GameButton(Content.Load<Texture2D>("ReturnToMenu"), new Vector2(250, 325));
            resumeGame = new GameButton(Content.Load<Texture2D>("StartButton"), new Vector2(250, 500));

            //Boot Menu
            TextField motto = new TextField(("Omnis Erigere Niger Vexillum"), new Vector2(200, 600));
            GameButton logoB = new GameButton(logo, new Vector2(graphics.PreferredBackBufferWidth / 2 - logo.Width / 2, graphics.PreferredBackBufferHeight / 2 - logo.Height / 2));
            bootMenu = new Menu(motto, this);
            bootMenu.AddMenuButton(logoB, ToMainMenu);

            //MainMenu
            TextField menuTitle = new TextField(("BOATS BOATS BOATS"), CenterText("BOATS BOATS BOATS", logoFont));
            mainMenu = new Menu(menuTitle, this);
            mainMenu.AddMenuButton(startButton, ToShipSelection);

            //PauseMenu
            TextField pauseTitle = new TextField("PAUSE", CenterText("PAUSE", logoFont));
            pauseMenu = new Menu(pauseTitle, this);
            pauseMenu.AddMenuButton(resumeGame, ToGameOn);
            pauseMenu.AddMenuButton(returnToMenu, ToMainMenu);

            //ShipSelectionMenu
            float x1 = (float)graphics.PreferredBackBufferWidth / 6 - playerBrig.Width / 2;
            float x2 = (x1 + ((float)graphics.PreferredBackBufferWidth / 3.0f)) - (playerFrigate.Width / 2);
            float x3 = (x2 + ((float)graphics.PreferredBackBufferWidth / 3.0f)) - (playerManOfWar.Width / 2);

            Vector2 ship1Pos = new Vector2(x1, (graphics.PreferredBackBufferHeight / 2) - playerBrig.Height / 2);
            Vector2 ship2Pos = new Vector2(x2, (graphics.PreferredBackBufferHeight / 2) - playerFrigate.Height / 2);
            Vector2 ship3Pos = new Vector2(x3, (graphics.PreferredBackBufferHeight / 2) - playerManOfWar.Height / 2);
            brigButton = new GameButton(playerBrig, ship1Pos);
            frigateButton = new GameButton(playerFrigate, ship2Pos);
            manOfWarButton = new GameButton(playerManOfWar, ship3Pos);

            TextField shipSelectionTitle = new TextField("CHOOSE YOUR SHIP", CenterText("CHOOSE YOUR SHIP", logoFont));
            shipSelectionMenu = new Menu(shipSelectionTitle, this);
            shipSelectionMenu.AddMenuButton(brigButton, LoadPlayerBrig);
            shipSelectionMenu.AddMenuButton(frigateButton, LoadPlayerFrig);
            shipSelectionMenu.AddMenuButton(manOfWarButton, LoadPlayerMOW);
            shipSelectionMenu.AddMenuText(new TextField(PLAYER_BRIG_DATA.PrintData(), new Vector2(brigButton.Position.X, brigButton.Position.Y + brigButton.Texture.Height + 20)));
            shipSelectionMenu.AddMenuText(new TextField(PLAYER_FRIG_DATA.PrintData(), new Vector2(frigateButton.Position.X, frigateButton.Position.Y + brigButton.Texture.Height + 20)));
            shipSelectionMenu.AddMenuText(new TextField(PLAYER_MOW_DATA.PrintData(), new Vector2(manOfWarButton.Position.X, manOfWarButton.Position.Y + brigButton.Texture.Height + 20)));

            #endregion
        }
 /// <summary>
 /// Construct new Player_Brig from PlayerData strucutre, texture to represent this ship, and a texture to represent the ship's projectile.  Is exactly the same as the constructor from Player so it only calls the base constructor
 /// </summary>
 /// <param name="d">PlayerData structure which is loaded from an XML file through the ContentPipeline of the main game</param>
 /// <param name="tex">Texture to represent the player</param>
 /// <param name="cBTex">Texture to represent the player's projectiles</param>
 public Player_Brig(PlayerData d, Texture2D tex, Texture2D cBTex)
     : base(d,tex,cBTex)
 {
 }
Example #5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            graphics.PreferredBackBufferHeight = (graphics.GraphicsDevice.DisplayMode.Height - (graphics.GraphicsDevice.DisplayMode.Height / 9));
            graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.DisplayMode.Width - (graphics.GraphicsDevice.DisplayMode.Width / 7);
            graphics.ApplyChanges();

            #region Textures
            playerBrig = Content.Load<Texture2D>("PlayerImages/Brig2_1");
            playerFrigate = Content.Load<Texture2D>("PlayerImages/Frigate");
            playerManOfWar = Content.Load<Texture2D>("PlayerImages/ManOfWar");
            enemyBrig = Content.Load<Texture2D>("EnemyImages/Brig2_1 - Enemy");
            enemyFireBoat = Content.Load<Texture2D>("EnemyImages/FireBoat");
            enemyFrigate = Content.Load<Texture2D>("EnemyImages/Frigate - Enemy");
            enemyManOfWar = Content.Load<Texture2D>("EnemyImages/ManOfWar - Enemy");
            healthPowerup = Content.Load<Texture2D>("HealthPowerup");
            BossTexture = Content.Load<Texture2D>("EnemyImages/Boss");
            #endregion

            BOSS_POSITION = new Vector2(BossTexture.Width / 2, graphics.PreferredBackBufferHeight / 2 - BossTexture.Height / 2);
            #region Main Menu
            logo = Content.Load<Texture2D>("BeardCoded2_1");
            logoFont = Content.Load<SpriteFont>("Fonts/LogoFont");
            mottoFont = Content.Load<SpriteFont>("Fonts/MottoFont");
            startButtonPos = new Vector2(300, 300);
            startButton = new Button(Content.Load<Texture2D>("StartButton"), startButtonPos);

            float x1 = (float)graphics.PreferredBackBufferWidth / 6 - playerBrig.Width / 2;
            float x2 = (x1 + ((float)graphics.PreferredBackBufferWidth / 3.0f)) - (playerFrigate.Width / 2);
            float x3 = (x2 + ((float)graphics.PreferredBackBufferWidth / 3.0f)) - (playerManOfWar.Width / 2);

            Vector2 ship1Pos = new Vector2(x1, (graphics.PreferredBackBufferHeight / 2) - playerBrig.Height / 2);
            Vector2 ship2Pos = new Vector2(x2, (graphics.PreferredBackBufferHeight / 2) - playerFrigate.Height / 2);
            Vector2 ship3Pos = new Vector2(x3, (graphics.PreferredBackBufferHeight / 2) - playerManOfWar.Height / 2);
            brigButton = new Button(playerBrig, ship1Pos);
            frigateButton = new Button(playerFrigate, ship2Pos);
            manOfWarButton = new Button(playerManOfWar, ship3Pos);
            returnToMenu = new Button(Content.Load<Texture2D>("ReturnToMenu"), new Vector2(250, 325));
            resumeGame = new Button(Content.Load<Texture2D>("StartButton"), new Vector2(250, 500));
            #endregion

            #region GameMaterial
            // Create a new SpriteBatch, which can be used to draw textures.
            // player = new Player_Brig(Content);
            //player = new Player_Frigate(Content);
            playerStartingPos = new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2);
            EnemyList = new List<Enemy>();
            spriteBatch = new SpriteBatch(GraphicsDevice);
            playerInteractableList = new List<PlayerInteractable>();
            friendlyList = new List<FriendlyShips>();

            //load player ship textures
            playerCBTexture = Content.Load<Texture2D>("CannonBall");
            enemyCBTexture = Content.Load<Texture2D>("CannonBall_Enemy");
            playerCBPowerUpTexture = Content.Load<Texture2D>("CannonBall_PowerUp");
            //Load HUD
            HUDFont = Content.Load<SpriteFont>("Fonts/HUDFont");
            healthBar = Content.Load<Texture2D>("healthBar");
            multiplierTexture = Content.Load<Texture2D>("Multiplier");
            #endregion

            #region Time Variables
            #endregion

            //Load object data
            #region ObjectData
            PLAYER_BRIG_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player_BrigData");
            PLAYER_FRIG_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player_FrigateData");
            PLAYER_MOW_DATA = Content.Load<PlayerData>("ObjectDataFiles/Player_ManOfWarData");

            FIREBOAT_DATA = Content.Load<EnemyData>("ObjectDataFiles/FireboatData");
            ENEMY_BRIG_DATA = Content.Load<EnemyData>("ObjectDataFiles/Enemy_BrigData");
            ENEMY_FRIG_DATA = Content.Load<EnemyData>("ObjectDataFiles/Enemy_FrigateData");
            ENEMY_MOW_DATA = Content.Load<EnemyData>("ObjectDataFiles/Enemy_ManOfWarData");

            FRIENDLY_SHIPS_DATA = Content.Load<EnemyData>("ObjectDataFiles/FriendlyShipsData");

            BOSS_DATA = Content.Load<EnemyData>("ObjectDataFiles/BossData");
            #endregion

            #region Sounds
            //load songs from folder and put in list
            BackgroundSongs = new List<Song>();
            //main menu theme
            mainMenuSong = Content.Load<SoundEffect>("Sounds/PirateWarsMainMenu");
            mainMenuSongInstance = mainMenuSong.CreateInstance();
            mainMenuSongInstance.IsLooped = true;
            //game music
            gameSong = Content.Load<SoundEffect>("Sounds/GIOmetryWars");
            gameSongInstance = gameSong.CreateInstance();
            gameSongInstance.IsLooped = true;
            //game over
            gameOverSong = Content.Load<SoundEffect>("Sounds/GameOver");
            gameOverSongInstance = gameOverSong.CreateInstance();
            #endregion

            BorderTexture = Content.Load<Texture2D>("Border");
        }