Ejemplo n.º 1
0
        public Hitbox GetHitBox()
        {
            Hitbox hitbox = new Hitbox();

            hitbox.X = Position.X;
            hitbox.Y = Position.Y;

            ProjectileData data = GetData();

            if (data != null)
            {
                hitbox.Width  = data.BoundsWidth;
                hitbox.Height = data.BoundsHeight;
            }

            return(hitbox);
        }
Ejemplo n.º 2
0
        public Hitbox GetHitbox()
        {
            Hitbox hitbox = new Hitbox();

            hitbox.X = RealX;
            hitbox.Y = RealY;
            SpriteData data = SpriteData.GetSpriteData(GetEnemyData().SpriteID);

            if (data != null)
            {
                if (Direction == FacingDirection.Left || Direction == FacingDirection.Right)
                {
                    hitbox.Width  = data.HorizontalBounds.X;
                    hitbox.Height = data.HorizontalBounds.Y;
                }
                else
                {
                    hitbox.Width  = data.VerticalBounds.X;
                    hitbox.Height = data.VerticalBounds.Y;
                }
            }

            return(hitbox);
        }
Ejemplo n.º 3
0
 public bool Intersects(Hitbox other)
 {
     return(Left() <= other.Right() && Right() >= other.Left() && Top() <= other.Bottom() && Bottom() >= other.Top());
 }