Exemple #1
0
        public static Vector2 shorten(this Vector2 vector, float maxLength)
        {
            if (vector.Length() > maxLength)
            {
                float currentOrigin = vector.toPolar().origin;

                vector = new PolarCoordinate(maxLength, currentOrigin).toCartesian();
            }

            return vector;
        }
Exemple #2
0
        public Ball(Shooter shotBy, Circle startingLocation, float angle, bool isSimulation = false)
            : base(Game1.game)
        {
            this.shotBy = shotBy;
            this.isSimulation = isSimulation;
            this.location = startingLocation;

            maxSpeed = PhysicsSettings.MAX_BALL_SPEED;
            color    = RandomHelper.randomBasicColor();
            velocity = new PolarCoordinate(PhysicsSettings.MAX_BALL_SPEED, angle).toCartesian();
        }