//// CST112 IN-CLASS TEST float sunX=300, sunY=50; float sunW=80, sunH=80, sunR=50;float sunDX=2, sunDY=1;float sunM=1.0;float surface=100; int fishMany=6;int fishRed= 200;float fishSpacing=50;float fishX=0, fishY=surface+100;float fishWidth=60, fishHeight=45; float sharkX=100, sharkY=360;float octoX=500, octoY=200;int score=0; void setup() { size(800,600); } void draw(){ scene(); fish(); shark(); octopus(); grading();} void grading() //// Exam grading { int gx=400, gy=20,gs=0; text( "X"+" WHO???.", gx,gy+13*gs++ ); text( 0+" fish.", gx,gy+12*gs++ ); text( 0+" octopus.", gx,gy+12*gs++ ); text( 0+" shark.", gx,gy+12*gs++ ); } void scene() //// waves on surface, rocks at bottom. { background( 200,200,255 ); // (Sky) //// Sun. //// ++++ ADD YOUR CODE HERE ++++ fill(255,255,0); noStroke(); ellipse(sunH,sunW,sunR,sunR); //// Water //// ++++ ADD YOUR CODE HERE ++++ noStroke(); fill(55,100,30); rect(0,surface, width= 800, height= 600 ); //// Waves on the surface. //// ++++ ADD YOUR CODE HERE ++++ } void fish() //// school of fish. { if (fishX>width || fishY>height || fishMany<1) // Check if done. Reset fish on left. { fishMany= 2 + (int) random(6); fishX= fishMany*fishSpacing; // Starting point for the leader. fishY= surface+random(height/2); fishWidth= 20+random(30); fishHeight= 0.75 * fishWidth; fishRed= 150 + (int) random(100); // Fish redness. } //// Move school of fish: 3 left, 2 down. //// ++++ ADD YOUR CODE HERE ++++ //// Draw each fish - size gets smaller //// ++++ ADD YOUR CODE HERE ++++ } void octopus() //// Octopus with 8 legs pointing toward shark. { strokeWeight(0); fill(50,30,100); rectMode(CORNER); octoX=mouseX; octoY=mouseY; //// Draw octopus, add 8 legs. //// ++++ ADD YOUR CODE HERE ++++ } void shark() //// Shark chases octopus. { fill(170,170,170); rectMode(CORNER); //// Move shark. //// ++++ ADD YOUR CODE HERE ++++ //// Draw shark. //// ++++ ADD YOUR CODE HERE ++++ //// Shark catches Octopus. if (dist(sharkX,sharkY,octoX,octoY) < 50) { //// ++++ YOUR CODE GOES HERE ++++ } }