(includes #1 & #2)

Monster, hero, gold, sun, etc.
PLUS buttons and a
waving grass, flock of birds, and a monkey ladder.

Project 3 includes all requirements of projects #1 and #2 as described here, plus:


Flock of birds:

A flock of birds flies across the screen in "Vee" formation, with each pair of birds slightly smaller, following behind and farther apart (one higher and one lower).

When the flock reaches one sid of the screen (right or left), reverse the direction of flight, change then height to a random value, and change the number of birds to a random number.
Be sure to change the shape of the birds, so that they face in the correct direction.

    |      |
    |      |
    |      |
    |      |
    | ,  / |
    |  ##  |
    |  ##  |
    |%     |
    |      |
    |      |
    |      |

As they fly, each bird should be "animated" to flap its wing up or down, every second or so (30 frames).

Waving grass:

At the bottom of the screen, draw some waving grass (evenly-spaced lines) that leans to the left or right following the direction of motion for one of the creatures (hero, monster, sun, etc.)

Ladder with climbing monkey.

Add a vertical ladder, somewhere on the screen, with a "monkey" that can climb the ladder, upward or downward.

When the "u" (or "d") key is clicked, have the monkey go UP (or DOWN) one step of the ladder, and change position of hands and feet (to provide a two-step animation). In one position, the monkey's right hand is reaching up and left leg is reaching down; reverse these positions for the next step.

Add some buttons to control the action.

Add an "UP" button and a "DOWN" button. When clicked, these buttons do the same thing as pressing the "u" or "d" key.

Add at least three more buttons, such as "QUIT" or "RESET" to do something to the screen, when clicked.




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

Make up names for your characters (hero and monster) and design a pattern for each that uses all of the following Library functions (methods):

		rect( ... )
		ellipse( ... )
		line( ... )
		triangle( ... )
The monster chases the hero, who chases after the gold. When the mouse is clicked, deduct 50 points, move the gold to a random position, and reset everything to starting positions: hero and monster on opposite sides of the screen, at random heights, with the gold at a random position near the center.

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;
		igorY +=  (vladY-igorY) / 150;
		if ( dist( vladX,vladY, igorX,igorY ) )   {
			// Monster catches hero!
			scor -= 100;
			reset();		// Move to opposite sides.
NOTE: Please don't call them Igor and Vlad! Make up your own names!

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

  • Monster on one side of the screen, at a random height
  • Hero on the other side, at random height.
  • Gold at a random position near the center of the screen.
  • // Since this reset is used elsewhere, you should make it a separate method.
		void setup() {
			size( ..., ... );

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

		void draw() {
			// Next frame. //
Write your own Java code for each of these methods, and also for mousePressed() keyPressed() .

The scene is a grassy field (filling most of the screen), under a light blue sky, with the sun moving slowly from left to right a few times per minute. Display a title and score at the top, and your name in the lower-left corner.

For project #2, 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:

		void drawVlad( float x, float y, float w, float h ) {
		  // Draw hero centered at (x,y) with body width w and height h //
		  rectMode( CENTER );
		  fill( ... );
		  rect( x,y, w,h );
		  text( "Vlad", x-w/3, y-h/4 );		// Name on shirt.
		  // Head //
		  float headHeight= 20;
		  head( headHeight, x, y-h-headHeight/2 );
		  // Legs (starting at hips). //
		  leg( 40, x-w/2, y+h/2 );    		// legs start at hips.
		  leg( 40, x+w/2, y+h/2 );
		  // Arms //
		  float armLength=h/3;
		  arm( armLength,  x-w/2, y-h/2 );  	// arms at shoulders
		  arm( -armLength,  x+w/2, y-h/2 );
		void head( float hh, float xh, float yh ) {
		  // Draw head and eyes //
		  ellipse( xh, yh, hh, hh*3/4 );
		  eye( xh-hh/6, yh-hh/4 );    		// left eye
		  eye( xh+hh/6, yh-hh/4 );    		// right eye

Also add a few birds that fly across the sky and drop bombs (when a key is pressed: 1 for the first bird, 2 for the second, etc.) If bomb hits monster, move him to one side of the screen at a random height.