Example #1
0
        public override void Hit(float damage)
        {
            if (!FirstInChain)
            {
                NormalBullet b = new NormalBullet(stats.Size / 2, 1, position, RandUnitVector2() * Player.BULLET_SPEED, NormalMap.blastWave2);
                NormalMap.AddGenericBlast((BlastWave)b);
            }
            else
            {
                float dx = position.X - Player.Position.X;
                float dy = position.X - Player.Position.Y;

                float a = (float)Math.Atan2(dy, dx);

                float adjustment = MathHelper.Pi - angle;

                a += adjustment;
                a  = WrapAngle(a);

                float diff = (angle + adjustment) - a;

                if (diff < 0)
                {
                    angle += ROTATE_SPEED;
                }
                else
                {
                    angle -= ROTATE_SPEED;
                }
            }
            base.Hit(damage);
        }