Example #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            _isPaused = false;

            _screenHeight = GraphicsDevice.Viewport.Height;
            _screenWidth = GraphicsDevice.Viewport.Width;

            input = InputFactory.GetInput();

            player = new Player();

            gameBackground = new GameBackground();

            fogForeground = new ParallaxingBackground();
            
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            enemyManager = new EnemyManager();
            _projectileManager = new ProjectileManager();
            laserCannon = new LaserCannon();

            base.Initialize();
        }
        public void Fire(GameTime gameTime, ProjectileManager manager, Vector2 position)
        {
            if (gameTime.TotalGameTime - _previousLaserSpawnTime > _laserSpawnTime)
            {
                _previousLaserSpawnTime = gameTime.TotalGameTime;

                AddLaser(manager, position);
                                
                _laserSoundInstance.Play();
            }
        }
        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 #4
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;
        }
Example #5
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;
        }