Ejemplo n.º 1
0
 /// <summary>
 /// Construct new Enemy from EnemyData structure, a texture for the enemy, and a texture for its cannon balls
 /// </summary>
 /// <param name="e">EnemyData structure that holds all initialization data.  Loaded from the main game using the ContentPipeline</param>
 /// <param name="tex">Texture representing this enemy</param>
 /// <param name="cBTex">Texture representing enemy cannon balls</param>
 public Enemy(EnemyData e, Texture2D tex, Texture2D cBTex)
     : base(e,tex,cBTex)
 {
     range = e.range;
     score = e.score;
     state = EnemyState.Chasing;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Construct a new Boss.  Takes an EnemyData structure, a texture to represent it, a texture to represent its projectiles, and the vector holding the coordinates where the spawns
 /// </summary>
 /// <param name="data"></param>
 /// <param name="tex"></param>
 /// <param name="cBTex"></param>
 /// <param name="start"></param>
 public Boss1(EnemyData data, Texture2D tex, Texture2D cBTex, Vector2 start)
     : base(data, tex, cBTex)
 {
     bossState = BossState.MovingToPosition;
     startingPos = start;
     CANNON_BALL_PERIOD = (float)(Math.PI);
     burstCount = 0;
     TOTAL_PER_BURST = 10;
 }
 public Enemy_Frigate(EnemyData d, Texture2D tex, Texture2D cbTex)
     : base(d, tex, cbTex)
 {
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Construct new FriendlyShip.  Requires EnemyData structure, Texture to represent it and a texture to represent its projectiles.
 /// </summary>
 /// <param name="d">EnemyData structure loaded from the main game from an XML file through the ContentPipeline.</param>
 /// <param name="tex">Texture to represent the ship</param>
 /// <param name="cBTex">Texture to represent the ship's projectiles</param>
 public FriendlyShips(EnemyData d, Texture2D tex, Texture2D cBTex)
     : base(d, tex, cBTex)
 {
     origin = new Vector2(tex.Width / 2, tex.Height / 2);
     speed = Vector2.Zero;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructs new Enemy Brig.  This constructor is exactly the same as for the Enemy class.
 /// </summary>
 /// <param name="d">EnemyData structure that holds all initialization data.  Loaded from the main game using the ContentPipeline</param>
 /// <param name="tex">Texture representing this enemy</param>
 /// <param name="cBTex">Texture representing enemy cannon balls</param>
 public Enemy_Brig(EnemyData d, Texture2D tex, Texture2D cBTex)
     : base(d, tex, cBTex)
 {
 }
 public Enemy_ManOfWar(EnemyData d, Texture2D tex, Texture2D cBTex)
     : base(d, tex, cBTex)
 {
 }
Ejemplo n.º 7
0
 public FireBoat(EnemyData d, Texture2D tex)
     : base(d, tex, null)
 {
 }
Ejemplo n.º 8
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");

            #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
        }
Ejemplo n.º 9
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");
        }