BUTTONS: Four buttons control the motion of the squids, as follows:
GAME OVER: When any squid reaches the surface, game is over, all motion stops, and the winner and loser are declared (by name, in messages on the screen).
SQUIDS: When setup or reset occurs, a new set of squids starts at the bottom. The number of squids should be random, from five to ten. The color, width, and number of legs for each squid is also random (but the names remain the same).
CONSTRUCTOR: should have only the following arguments:
// Set x, w, and name. Set h based on w. Also Squid( float x, String s, float w) { // ++++ ADD YOUR OWN CODE, HERE ++++ this.w= w; h= w * random(1.5, 3); // h is 1.5 to 3 * w // ++++ ADD YOUR OWN CODE, HERE ++++ } // ++++ (You may randomize color and number of legs here, or do it in reset.) |
DAY/NIGHT:
*
A sun or moon moves slowly across the sky from RIGHT to LEFT,
switching between night and day, when it reaches the right side (x == 0).
SUN/MOON:
*
The sun should be bright yellow during daytime, and change to a pale color at night.
(NOTE: You may use the same code for both sun and moon; just change the colors.
SKY
*
Light blue during daytime; darker blue at night.
WAVES
*
should appear on the surface of the sea.
(After drawing the the rectangular sea, make circles of the same color as the sky, from 0 to width.)
SWIMMING * Squid legs "swim" by slanting left and right, as the squid rises.
RESET BUTTON: *
NOTE:Most of the credit on this exam will be given for making the squids race upward, and properly identifying the winner and loser.Extra credit will be given for minor [ * or optional ] features such as sun/moon, day/night, legs swimming back and forth, RESET button, etc. as found in the example at http://www.suffolk.li/cst112/51cst112/students/Z/51bam.java , However, the squid arrays and loops are the most important parts! |