PROJECT #1
The big, bad monster chases the brave, little hero,
who chases after the gold, while the sun moves across the sky.

Design two animated creatures (a hero and a monster) that are drawn with at least three different fill colors, using drawing methods such as rect, ellipse,line, etc. The monster chases the hero, who chases after the gold. As they move about, the arms or legs of the animated creatures assume different positions (to simulate walking, crawling, etc.)

NOTE: The hero does NOT follow the mouse.
Hero chases gold at a certain rate; monster chases hero at a slower rate.


Declare global variables for the position coordinates (X,Y) of each object. Variable names should start with a small letter (NOT a Capital) for the first word, but you may Capitalize any additional words. If the names are "Igor" and "Vladimir" then global declarations might look something like this:
	//// GLOBALS ////
	float goldX, goldY;
	float igorX, igorY;
	float vladX, vladY; 
and the Java code to move the monster might look something like this:
	// Monster chases hero //
	igorX=  igorX + (vladX-igorX) / 150;	// Slowly chase hero
	igorY +=  (vladY-igorY) / 150;
	if (igorY < horizon-20) { igorY = horizon-40);
	// Monster catches hero!
	if ( dist( vladX,vladY, igorX,igorY ) < 50 )  {
	  scor -= 100;
	  reset();				// Move to side.
	} 
NOTE: Please don't call them Igor and Vlad! Make up your own names!

In the setup() method, reset everything to starting positions:

	//// SETUP:  window size, etc. ////
	void setup() {
		size( ..., ... );
		reset();
	}

Your code for the draw() method should not actually draw anything.
Instead, have it call other methods to do all the work.

	//// NEXT FRAME:  scene, monster, hero, etc.
	void draw() {
		scene();
		monster();
		hero();
		gold();
		messages();
	}

	//// SCENE:  sky, sun, grass.
	void scene() {
		background( 200, 200, 255 );	// Light blue sky.

			// ++++ ADD YOUR CODE HERE ++++ //
	} 
Write your own Java code for each of these methods, and also for mousePressed() keyPressed() .

SCENE & MESSAGES

The scene is a grassy field with a row of trees, under a light blue sky with the sun moving slowly from left to right a few times per minute. Display title and score at the top; your name in the lower-left corner. Somewhere above the horizon is a score and a button. The scene should include the following:

BUTTON & SCORING

When the button is clicked, deduct 50 points, move the gold to a random position, and reset everything to starting positions: hero in the house and monster at a random height on one side of the window (randomly left or right), and the gold at a random position near the center.


For this project, use functions with arguments to draw parts of the creatures on the screen, and add some animation (such as legs that "walk" or arms that "wave" or wings that "flap" or eyes that blink, etc.)
For example, code to draw the hero might look something like this:

	//// HERO:  Vlad is centered at (x,y) with body width w & height h //
	void drawVlad( float x, float y, float w, float h ) {
		// Body.
		rectMode( CENTER );
		fill( ... );
		rect( x,y, w,h );
		...					// etc.
	  	text( "Vlad", x-w/3, y-h/4 );		// Name on shirt.
		fill( ... );

		// Head //
		float headHeight= 20;
		head( headHeight, x, y-h-headHeight/2 );

		// Legs (starting at hips). //
		fill( ... );
		leg( 40, x-w/2, y+h/2 );		// legs start at hips.
		leg( 40, x+w/2, y+h/2 );

		// Arms //
		float shoulderY=  y - h/2;
		float armLength=h/3;
		arm( armLength,  x-w/2, shoulderY );	// arms at shoulders
		arm( -armLength,  x+w/2, shoulderY );
	}
	//// EYE:  tall ellipse, two eyes.
	void head( float h, float x, float y ) {
		// Draw head and two eyes //
		ellipse( x, y, h*3/4, h );	// Tall oval.
		eye( x-h/6, y-h/4 );		// left eye
		eye( x+h/6, y-h/4 );		// right eye
	}
	//// EYE:  blue circle inside white circle
	void eye( float a, float b) {
		. . .
	}
	. . .

Use the same head(), eye(), leg(), and arm() functions for both the hero and the monster.



Be sure to begin with comment lines that state the purpose of your program (as well as your name), and begin each method (procedure, function, subprogram) with a comment line that states its purpose.