void DoShot()
        {
            var PB = new PlayerBullet(Game, this, "Images/misc/crystal");

            PB.Hspeed = Ani.Flipped ? -2.5f : 2.5f;
            PB.x      = x + (Ani.Flipped ? -4 : 12);
            PB.y      = y + 10;
            if (!Controller[0] && !Controller[1])
            {
                if (Controller[2])
                {
                    PB.Hspeed *= 0.8f;
                    PB.Vspeed  = -(float)Math.Abs(PB.Hspeed);
                    PB.Hspeed *= 0.6f;
                }
                else if (Controller[3])
                {
                    PB.Hspeed *= 0.8f;
                    PB.Vspeed  = (float)Math.Abs(PB.Hspeed);
                    PB.Hspeed *= 0.6f;
                }
            }
            else
            {
                if (Controller[2])
                {
                    PB.Hspeed *= 0.9f;
                    PB.Vspeed  = -(float)Math.Abs(PB.Hspeed * 0.7);
                }
                else if (Controller[3])
                {
                    PB.Hspeed *= 0.9f;
                    PB.Vspeed  = (float)Math.Abs(PB.Hspeed * 0.7);
                }
            }
            PB.x -= PB.Hspeed;
            PB.y -= PB.Vspeed;
            PB.attacksterrain = currentshot == 1;
            PB.digpower       = (digpower) * 0.6667f;
            PB.touchDamage    = attackpower / (((totalshots - 1f) / 2f) + 1f);
            Game.AddEntity(PB);
        }
示例#2
0
        private void Shoot()
        {
            if (Target == null || ((ICombatant)Target).HP <= 0)
            {
                return;
            }
            var P = new PlayerBullet(entity.Game, entity, "images/misc/" + bulletgraphic);

            P.Position.CopyFrom(entity.getCenter());

            var D = (Target.getCenter() - P.Position);

            D.SetAsNormalize(bulletSpeed);
            P.Hspeed         = D.X;
            P.Vspeed         = D.Y;
            P.touchDamage    = attackpower;
            P.ignoresterrain = ignoresterrain;
            P.Duration       = bulletDuration;
            entity.Game.AddEntity(P);
        }