private void AddEnemy(Vector2 boss_pos) { // Create the animation object Animation enemyAnimation = new Animation(); // Initialize the animation with the correct animation information enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 32, 32, 4, 100, Color.White, 1f, true); int posheight = GraphicsDevice.Viewport.Height; float x_coord = boss.Position.X + 92; //float x_coord = boss_x_coords[0,1]; float y_coord = boss.Position.Y + 44; Vector2 position = new Vector2(x_coord,y_coord); // Create an enemy Enemy enemy = new Enemy(); // Initialize the enemy enemy.Initialize(enemyAnimation, position, player.Position); // Add the enemy to the active enemies list enemies.Add(enemy); }
private void AddExplosion(Vector2 position) { Animation explosion = new Animation(); explosion.Initialize(explosionTexture, position, 32, 32, 6, 45, Color.White, 1f, false); explosions.Add(explosion); }
/// <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 // Load the player resources //Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("player"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 65, 128, 3, 30, Color.White, 1f, true); Vector2 playerPosition = new Vector2(200,300); player.Initialize(playerAnimation, playerPosition) ; enemyTexture = Content.Load<Texture2D>("shot"); bossTexture = Content.Load<Texture2D>("boss"); boss.Initialize(GraphicsDevice.Viewport, bossTexture, new Vector2(100f, 100f), GraphicsDevice.Viewport.Width); Texture2D small_starTexture = Content.Load<Texture2D>("small_star"); //bg.Initialize(GraphicsDevice.Viewport, bossTexture, new Vector2(100f, 100f)); projectileTexture = Content.Load<Texture2D>("projectile"); explosionTexture = Content.Load<Texture2D>("explosion"); // Load the music gameplayMusic = Content.Load<Song>("sound/gameMusic"); // Load the laser and explosion sound effect laserSound = Content.Load<SoundEffect>("sound/projectile"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); // Load the score font font = Content.Load<SpriteFont>("SpriteFont1"); // Start the music right away //PlayMusic(gameplayMusic); }