A predefined set of movement keys where the arrow keys ("UP", "DOWN", "LEFT" and "RIGHT") are associated
with their respective directions and the "END" key is associated with stopping.
Constructor for the BallControl class
Instantiates the BallGUI frame with the required ILambdas for
making a ball, clearing the balls from the screen and for
painting the balls onto the Container
Starts the timer up.
No-parameter constructor that instantiates the AffineTransform used
internally and randomly loads one of two files:
ballwar\model\paint\images\humbird4.gif or
ballwar\model\paint\images\img104c.gif with a fill factor of 0.5.
An ANoOpStrategy-based strategy that only only overrides the updateState behavior
to make the ball's radius grower larger and smaller in a random sinusoidal manner.
An ANoOpStrategy-based strategy that, upon colliding with another ball, may replace its context
with a number of smaller balls with the same strategy, unless the context's radius is below
a minumum length, upon which the context is simply killed.
Interface that represents a strategy used by a Ball when asked to perform variant operations associated
with initialization, updating its state, collisions and destruction.
Instantiates a Shape object that is the prototype Polygon translated
by the given (x, y) point and scaled by given (xScale, yScale) factor
times the internal scaleFactor.
Constructor that uses an externally defined AffineTransform for internal
use plus takes the defining points of the prototype Polygon and
a scale factor to scale the given points to the desired unit size.
No-parameter constructor that instantiates the
AffineTransform for internal use plus defines a
prototype Rectangle of a width = 8/3 and height = 2/3
which is an average radius of 1.
Constructor that takes an external AffineTransform for internal use
and a Rectangle centered at (x, y) with the given half-width
and half-height (= x-radius and y-radius).
Takes an IMovementKeys object which defines a set of movement keys and
associates the pressing of each key with its respective behavior in the given IMoveable
object.
An AUpdateStrategy-based strategy whose updateState is a no-op hence the randomly initialized ball will travel in a straight line (unless it collides or bounces).
With a given probability, explodes the context ball into a number of smaller balls,
unless the context's radius is below a minimum length, upon which the
context is killed and no more balls are made.
I the count is non-positive, saves the color of the context, sets the count to a preset value and
sets the color of the context to a preset "lit up" value.
Updates the state of the ball by calling the strategy's updateState(), moving the ball as per its velocity, bouncing off the walls if necessary,
and notifying all other balls that it may have collided with them.