Пример #1
0
        void clipPrev()
        {
            // get the previous item (second item)
            BodySegment previous    = bodySegments[1];
            double      removeAngle = previous.velocity.Degrees * Math.PI / 180 + Math.PI; // angle to remove material (add pi to flip around)
            // amount to shrink in each dimension
            int dx = (int)((BodyPart.SIZE - overlap) * Math.Cos(removeAngle));
            int dy = (int)((BodyPart.SIZE - overlap) * Math.Sin(removeAngle));

            previous.shrink(dx, dy); // shrink it

            // clip the collider for this segment to the proper size
            // amount to shrink in each dimension
            dx = (int)((BodyPart.SIZE) * Math.Cos(removeAngle));
            dy = (int)((BodyPart.SIZE) * Math.Sin(removeAngle));
            previous.shrinkBounds(dx, dy); // shrink it
        }