Esempio n. 1
0
        public Position StopPosition(GamePitch pitch)
        {
            double   distance     = (speed * speed) / (2 * friction);
            Vector   scaledVector = vector.getScaledVector(distance);
            Position stopPosition = position.getPositionPlusVector(scaledVector);

            stopPosition.AdjustBounce(pitch);
            return(stopPosition);
        }
Esempio n. 2
0
        public void AdjustBounce(GamePitch pitch)
        {
            if (this.x < 0.0)
            {
                this.x *= -1.0;
            }
            if (this.x > pitch.width)
            {
                this.x = pitch.width - (this.x - pitch.width);
            }

            if (this.y < 0.0)
            {
                this.y *= -1.0;
            }

            if (this.y > pitch.height)
            {
                this.y = pitch.height - (this.y - pitch.height);
            }
        }