public void Initialize(Animation animation, Vector2 position) { // Load the enemy ship texture bossAnimation = animation; // Set the position of the enemy Position = position; WeaponPosition.X = position.X + 160; WeaponPosition.Y = position.Y + 200; // We initialize the enemy to be active so it will be update in the game Active = true; WeaponActive = true; // Set the health of the enemy Health = 20000; WeaponHealth = 10000; // Set the amount of damage the enemy can do Damage = 100; // Set how fast the enemy moves enemyMoveSpeed = 1.5f; // Set the score value of the enemy Value = 10000; }
public void Initialize(Animation animation, Vector2 position) { PowerupAnimation = animation; Position = position; Active = true; powerupMoveSpeed = 6f; }
// Initialize the player public void Initialize(Animation animation, Vector2 position) { PlayerAnimation = animation; // Set the starting position of the player around the middle of the screen and to the back Position = position; // Set the player to be active Active = true; // Set the player health Health = 100; }
public void Initialize(Animation animation, Vector2 position) { // Load the enemy ship texture EnemyAnimation = animation; // Set the position of the enemy Position = position; // We initialize the enemy to be active so it will be update in the game Active = true; // Set the amount of damage the enemy can do Damage = 20; // Set how fast the enemy moves enemyMoveSpeed = 4f; // Set the score value of the enemy }
public void Initialize(Animation animation, Vector2 position, Viewport viewport) { // Load the enemy ship texture MissileAnimation = animation; // Set the position of the enemy Position = position; // We initialize the enemy to be active so it will be update in the game Active = true; screen = viewport; // Set the amount of damage the enemy can do Damage = 50; // Set how fast the enemy moves projectileMoveSpeed = 15f; }
public void Initialize(Animation animation, Vector2 position, int multiplier) { // Load the enemy ship texture EnemyAnimation = animation; // Set the position of the enemy Position = position; // We initialize the enemy to be active so it will be update in the game Active = true; // Set the health of the enemy Health = 75 * multiplier; // Set the amount of damage the enemy can do Damage = 50; // Set how fast the enemy moves enemyMoveSpeed = 3f; // Set the score value of the enemy Value = 300; }
private void AddShootingEnemy() { // Create the animation object Animation enemyAnimation = new Animation(); // Initialize the animation with the correct animation information enemyAnimation.Initialize(shootingEnemyTexture, Vector2.Zero, 100, 55, 1, 30, Color.White, 1f, true); // Randomly generate the position of the enemy Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + shootingEnemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); // Create an enemy ShootingEnemy shootingEnemy = new ShootingEnemy(); // Initialize the enemy shootingEnemy.Initialize(enemyAnimation, position, secondHealthMultiplier); // Add the enemy to the active enemies list shootingEnemies.Add(shootingEnemy); TimeSpan fireTime = TimeSpan.FromSeconds(1f); TimeSpan previousFireTime = TimeSpan.Zero; enemyFireTimes.Add(fireTime); previousEnemyFireTimes.Add(previousFireTime); }
private void AddPowerup(Vector2 position) { Animation powerAnimation = new Animation(); powerAnimation.Initialize(powerupTexture, Vector2.Zero, 36, 36, 4, 30, Color.White, 1f, true); //Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); Powerup powerup = new Powerup(); powerup.Initialize(powerAnimation, position); powerups.Add(powerup); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); bigBossTexture = Content.Load<Texture2D>("Sprites/BigBoss"); asteroidTexture = Content.Load<Texture2D>("Sprites/Asteroid"); shootingEnemyTexture = Content.Load<Texture2D>("Sprites/shootingEnemyAnimation"); enemyTexture = Content.Load<Texture2D>("Sprites/mineAnimation"); bossTexture = Content.Load<Texture2D>("Sprites/BigMine"); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("Sprites/shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); player.Initialize(playerAnimation, playerPosition); // Load the parallaxing background bgLayer1.Initialize(Content, "Images/bgLayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "Images/bgLayer2", GraphicsDevice.Viewport.Width, -2); mainBackground = Content.Load<Texture2D>("Images/mainbackground"); projectileTexture = Content.Load<Texture2D>("Sprites/laser"); missileTexture = Content.Load<Texture2D>("Sprites/Missiles"); explosionTexture = Content.Load<Texture2D>("Sprites/explosion"); powerupTexture = Content.Load<Texture2D>("Sprites/Powerup-Laser"); allyPowerTexture = Content.Load<Texture2D>("Sprites/Powerup-Ally"); healthPowerupTexture = Content.Load<Texture2D>("Sprites/healthUP"); // Load the score font font = Content.Load<SpriteFont>("gameFont"); // Load the music gameplayMusic = Content.Load<Song>("sound/gameMusic"); // Load the laser and explosion sound effect laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); // Start the music right away PlayMusic(gameplayMusic); // TODO: use this.Content to load your game content here }
private void addMini() { Animation miniAnimation = new Animation(); miniTexture = Content.Load<Texture2D>("Sprites/MiniShip"); miniAnimation.Initialize(miniTexture, Vector2.Zero, 58, 35, 8, 30, Color.White, 1f, true); Vector2 miniPosition = new Vector2(player.Position.X + random.Next(-50, 50), GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); MiniShip mini = new MiniShip(); mini.Initialize(miniAnimation, miniPosition); TimeSpan miniPrevious = TimeSpan.Zero; TimeSpan miniFireTime = TimeSpan.FromSeconds(.15f); TimeSpan miniMissilePrevious = TimeSpan.Zero; TimeSpan miniMissileFireTime = TimeSpan.FromSeconds(3f); miniShips.Add(mini); miniPreviousFireTimes.Add(miniPrevious); miniFireTimes.Add(miniFireTime); miniMissileFireTimes.Add(miniMissileFireTime); previousMiniMissileFireTimes.Add(miniMissilePrevious); }
private void AddExplosion(Vector2 position) { Animation explosion = new Animation(); explosion.Initialize(explosionTexture, position, 134, 134, 12, 45, Color.White, 1f, false); explosions.Add(explosion); }
private void AddEnemy() { // Create the animation object Animation enemyAnimation = new Animation(); // Initialize the animation with the correct animation information enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true); // Randomly generate the position of the enemy Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); // Create an enemy Enemy enemy = new Enemy(); // Initialize the enemy enemy.Initialize(enemyAnimation, position, healthMultiplier); // Add the enemy to the active enemies list enemies.Add(enemy); }
private void AddBoss() { // Create the animation object Animation bossAnimation = new Animation(); // Initialize the animation with the correct animation information bossAnimation.Initialize(bossTexture, Vector2.Zero, 308, 400, 8, 30, Color.White, 1f, true); // Randomly generate the position of the enemy Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + bossTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); // Create an enemy Boss1 boss = new Boss1(); // Initialize the enemy boss.Initialize(bossAnimation, position, healthMultiplier); bosses.Add(boss); }
private void AddBigBoss() { // Create the animation object Animation bigBossAnimation = new Animation(); // Initialize the animation with the correct animation information bigBossAnimation.Initialize(bigBossTexture, Vector2.Zero, 550, 300, 1, 20, Color.White, 1f, true); // Randomly generate the position of the enemy Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + bigBossTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); // Create an enemy BigBoss boss = new BigBoss(); // Initialize the enemy boss.Initialize(bigBossAnimation, position); TimeSpan fireTime = TimeSpan.FromSeconds(1f); TimeSpan previous = TimeSpan.Zero; bigBossPreviousWeaponFireTimes.Add(previous); bigBossWeaponFireTimes.Add(fireTime); bigBosses.Add(boss); }
private void AddAsteroid() { // Create the animation object Animation asteroidAnimation = new Animation(); // Initialize the animation with the correct animation information asteroidAnimation.Initialize(asteroidTexture, Vector2.Zero, 80, 60, 1, 30, Color.White, 1f, true); // Randomly generate the position of the enemy Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + asteroidTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); // Create an enemy Asteroid asteroid = new Asteroid(); // Initialize the enemy asteroid.Initialize(asteroidAnimation, position); // Add the enemy to the active enemies list asteroids.Add(asteroid); }
private void addAllyPowerup(Vector2 position) { Animation allyPowerAnimation = new Animation(); allyPowerAnimation.Initialize(allyPowerTexture, Vector2.Zero, 74, 75, 4, 20, Color.White, 1f, true); //Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); AllyPowerup powerup = new AllyPowerup(); powerup.Initialize(allyPowerAnimation, position); allyPowerups.Add(powerup); }
private void AddMissile(Vector2 position) { Animation missileAnimation = new Animation(); missileAnimation.Initialize(missileTexture, position, 120, 22, 4, 20, Color.White, 1f, true); Missile missile = new Missile(); missile.Initialize(missileAnimation, position, GraphicsDevice.Viewport); missiles.Add(missile); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here Animation playerTwoAnimation = new Animation(); Texture2D playerTwoTexture = Content.Load<Texture2D>("Sprites/shipAnimation"); playerTwoAnimation.Initialize(playerTwoTexture, Vector2.Zero, 115, 69, 8, 30, Color.Purple, 1f, true); Vector2 playerTwoPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.Width/2, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 4); playerTwo.Initialize(playerTwoAnimation, playerTwoPosition); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("Sprites/shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); player.Initialize(playerAnimation, playerPosition); // Load the parallaxing background bgLayer1.Initialize(Content, "Images/bgLayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "Images/bgLayer2", GraphicsDevice.Viewport.Width, -2); mainBackground = Content.Load<Texture2D>("Images/mainbackground"); enemyTexture = Content.Load<Texture2D>("Sprites/sampleEnemy"); explosionTexture = Content.Load<Texture2D>("Sprites/explosion"); projectileTexture = Content.Load<Texture2D>("Sprites/laser"); }