Example #1
0
        public void Initialize(Animation animation, Death death, Vector2 position, Texture2D hitbox)
        {
            Initialize(animation, death, position);

            _hitbox = hitbox;
            _showHitbox = true;
        }
Example #2
0
        public void Initialize(Animation animation, Vector2 position)
        {
            Damage = 10;
            Range = 100;

            Animation = animation;
            Position = position;
            
            moveSpeed = 30f;

            Active = true;
        }
        public Explosion GetExplosion()
        {
            Animation explosionAnimation = new Animation();
            explosionAnimation.Initialize(_explosionStrip, Vector2.Zero, 133, 134, 12, 30, Color.White, 1f, false);

            SoundEffectInstance explosionSoundInstance = _explosionSound.CreateInstance();
            explosionSoundInstance.Volume = .1f;

            Explosion explosion = new Explosion(explosionAnimation, explosionSoundInstance);

            return explosion;
        }
        private void AddLaser(ProjectileManager manager, Vector2 position)
        {
            Animation laserAnimation = new Animation();
            laserAnimation.Initialize(_laserTexture, Vector2.Zero, 46, 16, 1, 30, Color.White, .75f, true);

            Laser laser = new Laser();

            var laserPosition = position;
            laserPosition.X += 40;
            laserPosition.Y += 24;

            laser.Initialize(laserAnimation, laserPosition);
            manager.Add(laser);
        }
Example #5
0
        public void Initialize(Animation animation, Death death, Vector2 position)
        {
            Animation = animation;
            Position = position;            
            
            _death = death;

            Active = true;

            Health = 10;

            Damage = 10;

            moveSpeed = 6f;

            Value = 100;
        }
Example #6
0
        public void Initialize(Animation animation, Death death, Vector2 position, Input input, ProjectileManager projectileManager, int heightBoundry, int widthBoundry)
        {
            Animation = animation;

            Position = position;

            _input = input;
            _projectileManager = projectileManager;

            _heightBoundry = heightBoundry;
            _widthBoundry = widthBoundry;
                        
            _death = death;

            Active = true;

            //Health = 20;
            Health = 100;

            moveSpeed = 8f;
        }
        private void AddEnemy()
        {
            Enemy enemy = new Enemy();

            Animation enemyAnimation = new Animation();
            enemyAnimation.Initialize(_enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);

            Vector2 position = new Vector2(_screenWidth + _enemyTexture.Width / 2,
                _random.Next(10, _screenHeight - 50));

            Death death = new EnemyDeath();
            death.Initialize(_explosionFactory);

            if (_hitboxTexture != null)
            {
                enemy.Initialize(enemyAnimation, death, position, _hitboxTexture); 
            }
            else
            {
                enemy.Initialize(enemyAnimation, death, position);
            }

            Enemies.Add(enemy);
        }
Example #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()
        {
            // 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

            _hitboxTexture = Content.Load<Texture2D>("Graphics/HitboxDim");

            SoundEffect explosionSound = Content.Load<SoundEffect>("Sounds/explosion");
            Texture2D explosionStrip = Content.Load<Texture2D>("Graphics/explosion");
            ExplosionFactory explosionFactory = new ExplosionFactory(explosionStrip, explosionSound);

            //Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X,
            //    GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);

            Vector2 playerPosition = new Vector2(0, _screenHeight / 2);

            Animation playerAnimation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("Graphics/shipAnimation");

            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 35, Color.White, .75f, true);

            Death playerDeath = new PlayerDeath();
            playerDeath.Initialize(explosionFactory);

            //player.Initialize(playerAnimation, playerPosition, input, _projectileManager, _screenHeight, _screenWidth, _hitboxTexture);
            player.Initialize(playerAnimation, playerDeath, playerPosition, input, _projectileManager, _screenHeight, _screenWidth);

            Texture2D enemyTexture = Content.Load<Texture2D>("Graphics/mineAnimation");

            _projectileManager.Initialize(_screenWidth, _screenHeight);

            //enemyManager.Initialize(enemyTexture, explosionStrip, explosionSound, _screenWidth, _screenHeight, _hitboxTexture);
            enemyManager.Initialize(enemyTexture, explosionFactory, _screenWidth, _screenHeight);

            ParallaxingBackground bgLayer1 = new ParallaxingBackground(); 
            ParallaxingBackground bgLayer2 = new ParallaxingBackground();

            bgLayer1.Initialize(Content.Load<Texture2D>("Graphics/bgLayer1"), _screenWidth, _screenHeight, -1);
            bgLayer2.Initialize(Content.Load<Texture2D>("Graphics/bgLayer2"), _screenWidth, _screenHeight, -2);

            Texture2D mainBackground;
            mainBackground = Content.Load<Texture2D>("Graphics/mainbackground");

            gameBackground.Initialize(mainBackground, new ParallaxingBackground[] { bgLayer1, bgLayer2 }, _screenWidth, _screenHeight);

            fogForeground.Initialize(Content.Load<Texture2D>("Graphics/WispyClouds2"), _screenWidth, _screenHeight, -2);

            SoundEffect laserSound = Content.Load<SoundEffect>("Sounds/LaserFire");
            Texture2D laserTexture = Content.Load<Texture2D>("Graphics/laser");
            laserCannon.Initialize(laserTexture, laserSound);
            
            player.Weapon = laserCannon;

            gameMusic = Content.Load<Song>("Music/gameMusic");

            _pauseBackground = Content.Load<Texture2D>("Graphics/Pause");

            MediaPlayer.Volume = .75f;
            MediaPlayer.Play(gameMusic);
        }
Example #9
0
 public Explosion(Animation animation, SoundEffectInstance soundEffect)
 {
     Animation = animation;
     _soundEffect = soundEffect;
 }
Example #10
0
 public void Initialize(Animation animation, Vector2 position)
 {
     Animation = animation;
     Position = position;
 }
Example #11
0
        public void Initialize(Animation animation, Death death, Vector2 position, Input input, ProjectileManager projectileManager, int heightBoundry, int widthBoundry, Texture2D hitbox)
        {
            Initialize(animation, death, position, input, projectileManager, heightBoundry, widthBoundry);

            _hitbox = hitbox;
        }