Esempio n. 1
0
        protected override void ShootingPattern(GameTime gameTime)
        {
            EnemyHomingBullet bullet = new EnemyHomingBullet(Game, spriteSheet, player);

            bullet.Position  = Position;
            bullet.Direction = MathFunctions.ScaleDirection(ShootObject.Position - Position);
            bullet.Initialize();

            Game.stateManager.shooterState.gameObjects.Add(bullet);
        }
Esempio n. 2
0
        private void HandleShooting(GameTime gameTime)
        {
            lastTimeShot += gameTime.ElapsedGameTime.Milliseconds;

            if (lastTimeShot >= shootingDelay)
            {
                lastTimeShot -= shootingDelay;

                double width         = Math.PI;
                int    numberOfShots = 4;

                for (double dir = -width / 2 + Math.PI / 2; dir <= width / 2 + Math.PI / 2; dir += (width / numberOfShots))
                {
                    EnemyHomingBullet bullet = new EnemyHomingBullet(Game, spriteSheet, player);
                    bullet.Position  = Position;
                    bullet.Direction = MathFunctions.DirFromRadians(dir);
                    bullet.Initialize();

                    Game.stateManager.shooterState.gameObjects.Add(bullet);
                    Game.soundEffectsManager.PlaySoundEffect(SoundEffects.SmallLaser, soundPan);
                }
            }
        }