CST 112 Test #1
+ takehome test


S P E C I F I C A T I O N S

FIELD: Draw a rectangular field for playing a game similar to tennis, with a "net" down the center of the field (as illustrated below). Use the following variable names to describe the boundaries and net position:
        top left center right bottom
Display a title centered near top of the screen, your name at lower left, and a "score" at upper left.

BALL: The ball begins at a random height on the left side of the field, with random velocity (DX, DY) and a random color (RGB).
The ball moves at constant velocity until it hits boundary and bounces off, reversing either DX or DY (not both!)
(Reverse only DX for left or right; DY for top/bottom.)

PENALTY: If ball hits right side (i.e. the player has missed it!), the player loses 50 points from the score.

PLAYER: The "player" (using variables that begin with the first two letters of your first name) has a rectangular body with his name in text, and a circular head, plus two legs below the body, and two eyes within the head. Do not write two sets of similar statements to draw each leg or each eye; instead, write functions that each take two arguments to give the position, and draw a single eye or leg:

	void eye( float x, float y) {
	    // Draw one eye at (x,y)
	    ....
	}
	void leg( float x, float y) {
	    // Draw one leg at (x,y)
	    ....
	} 
The player may must remain within the right half of the screen, always moving toward the mouse (when possible) at a rate that would cover half the distance in two seconds (60 frames).
However, the player may not cross the net (georgeX < center), nor go out of bounds (top, right, bottom).

ACTION: Ball bounces away (reversing both DX and DY) when ball is within 20 pixels of player:
        dist( ballX,ballY, georgeX,georgeY ) is less than 20

SCORING: Score is increased by 50 points if the player hits the ball while it was coming in from the left:
        ballX was less than georgeX
Note that there is no score change when the player mistakenly hits the ball back the wrong way (to the right), because it will bounce off the right wall and and points will then be lost.

OPTIONAL RACKET: also show a "tennis racket" (see illustration) pointing to the left or right, depending on position of the ball.

OPTIONAL VOLLEY: When the ball hits the left side, it is "served" back with small random variations in speed
        ballDX= -ballDX * random(0.5, 2.0);
and a "volley "counter" is increased by one; after ten volleys, replace the with a new ball (starting from left, with random color and velocity).

OPTIONAL BIRD: A little bird (blue triangle) flies up and down, along the right side, facing right on the way down, facing left on the way up.

OPTIONAL DOG: A little dog (brown rectangles for body, head, and tail) runs back and forth along the top of the field. head should be at the front, and tail at the back.

KEYS: If the 'q' key is pressed, the program exits.
When 'r' key pressed, new ball is created, and player loses 20 score points.
When 'p' or '?' is pressed, game is paused and instructions displayed.

OPTIONAL BUTTON: Add a button (somewhere on the left side) that does the same thing as the 'r' key (creae new ball, deduct 20 points).

REMEMBER: Features marked "OPTIONAL" are required for takehome, but may be omitted on test1.