/*_DO_NOT_COPY_THIS_CODE!!_*/ String/**/title="CST 112 exam #1"; String/**/subtitle="Monster chases Bob (and Mutt)."; String/**/hint="Click to reposition hero & dog." + "\n 'r' to reset all;'q' to quit.";String/**/news="";color/**/newsColor; String/**/author="B.A.Martin / q1b.pde"; String/**/who="Bob",dogname="Mutt",monster="Cyclops"; int frames=30;boolean day=true;float/**/horizon,ladderX=10;float/* */sunX,sunY,sunbobDX=1;float/**/bobX,bobY,bobDX,bobDY;float/**/muttX,muttY; float/* */cyclopsX,cyclopsY;float/**/houseX=100,houseY=150,houseW=200,houseH=100; float/**/rockW,rockH,rockSpace,flowerSpace;int maxTrees=10,nTrees=1;Tree t1;int score=0; color/**/RED=color(255,0,0),GREEN=color(0,255,0),BLUE=color(0,0,255); color/**/YELLOW=color(255,255,0),MAGENTA=color(0,255,255),CYAN=color(255,0,255); color/**/PINK=color(255,200,220),BROWN=color(127,0,0),DARK=color(0,150,0); color/**/WHITE=color(255),BLACK=color(0),PALE=color(200);/**/ /*_DO_NOT_COPY_THIS_CODE!!_*/void/**/setup() {size(800,600); smooth();frameRate(frames);horizon=height/3; houseY=horizon-houseH;reset(); }void/**/reset(){sunX=50;sunY=random( /**/30,horizon-50); rockW=random(20,40); rockH=random(15,30); rockSpace=random(40,60); flowerSpace=random(30,50); t1=new Tree();home(); }void/**/home(){bobX=houseX+50; bobY=houseY+10;bobDX=random(2,7);bobDY=random(-3,+3);cyclopsX=random(width/2,width); cyclopsY=random(horizon+100,height-100);}void/* */draw(){scene();action();show();messages(); }void/**/scene(){if(day){background(150,200,250);fill(YELLOW); }else{background(50,100,150);fill(PALE);}ellipse(sunX,sunY,40,40);fill(GREEN); if(!day){fill(DARK);}rect(0,horizon,width,height-horizon);trees(); house();flowers();rocks();ladder(); }void/**/flowers(){for(float/**/x=houseX+houseW+20;x width){sunX=0; sunY=random(30,horizon-30);day=!day;news=day?"Day":"Nite";}sunX=sunX+sunbobDX; if(bobX>width-30){bobDX=-bobDX;news="Ouch!";++score;}if(bobX<60){bobDX=-bobDX;news="Ouch!";++score;} if(bobY>height-70){bobDY=-bobDY;news="Bounce.";++score;}if(bobYcyclopsX?-2:+2;fill(0,150,0); ellipse(bobX+15+look,bobY-23,4,4); ellipse(bobX+35+look,bobY-23,4,4); }void/**/dog(){fill(BROWN);rect(muttX,muttY,70,30);float/* */xHead,yHead;xHead=muttX+50;yHead=muttY-20; rect(xHead,yHead,40,20); fill(YELLOW); text("Mutt",muttX+15,muttY+15);fill(255); ellipse(xHead+12,yHead+5,12,12); fill(0,150,0); ellipse(xHead+12,yHead+3,4,4); }void/**/monster(){fill(0); ellipse(cyclopsX,cyclopsY,40,50); if(!day){fill(255);ellipse(cyclopsX,cyclopsY-8,16,16); fill(255,100,0);ellipse(cyclopsX,cyclopsY-8,8,8);}fill(0); rect(cyclopsX-30,cyclopsY+25,60,90); float/**/legX=cyclopsX-20,legY=cyclopsY+25+90; float/**/step=(cyclopsX%40<20)?-10:+10; strokeWeight(16);line(legX,legY,legX+step,legY+40); line(legX+40,legY,legX+40+step,legY+40);strokeWeight(1); rect(legX+step-16,legY+40,32,16);rect(legX+40+step-16,legY+40,32,16); if(!day){strokeWeight(12);float/**/armX=bobX