/// Fish tank /// Victor Pineda String title="Fish Tank"; String author="Victor Pineda, CST112, Project 2"; float left= 20, right=left+600, top=50, bottom=top+400; Fish es; Fish ce; int many=5; Fish[] school= new Fish[many]; void setup() { // setup size( 600, 500); reset(); } void reset() { es= new Fish(); ce= new Fish(); //// Many fishes in array for (int i=0; i right -50 ) dx= -dx; if(y< top +50 || y> bottom -50) dy= -dx; dx= dx + random( -1, +1 ); x= x + dx; y= y + dy; } void show() { // draw on screen fill (r, g, b); // body rectMode( CENTER ); ellipse(x, y, w, h); //fish tail float tailf= x-40, tailb= x+40; if( dx>0) { fill(150, 50, 50); triangle(tailf+10, y, tailf-10, y-20, tailf-15, y+20); } else { fill(150, 50, 50); triangle(tailb-10, y, tailb+10, y-20, tailb+15, y+20); } // fish eye float eyef= x+16, eyeb= x-16; if( dx>0) { fill(250, 250, 250); ellipse(eyef, y-10, 10, 10); fill(0, 0, 250); ellipse(eyef, y-10, 4, 4); } else { fill(250, 250, 250); ellipse(eyeb, y-10, 10, 10); fill(0, 0, 250); ellipse(eyeb, y-10, 4, 4); } } }/// End class fish