// In Class Project ////Francesco Vassallo int score=0; float horizon=height/2; float sunX=100, sunY=100; float zoogX, zoogY; float mrsticksX, mrsticksY; float goldX,goldY; int count=0; void setup(){ // setup // size (600,400); horizon= height/2; sunY= horizon/2; zoogX=width/2; zoogY=height/2; goldX=width; goldY=height; mrsticksX=30; mrsticksY=random(horizon, height-60); } void draw(){ //next frame// scene(); zoog(); gold(); mrsticks(); scoring(); count=count=1; } void scene(){ //the environment background (136,206,235); fill(255,255,0); //Sun ellipse (sunX,sunY, 50,50); fill (100,255,100); // The Grass rectMode(CORNER); rect (0,horizon, width,height*3/4); // Make the sun move// if (sunX > width) { sunX=0; sunY= random( 10, horizon-2); score= score+10; } sunX= sunX+2; fill(0); // text( sunX, sunX, sunY+40); text( "SCORE= " + score, width-200, 50 ); } void zoog (){ //make Zoog movable// zoogX=zoogX+ (mouseX-zoogX)/30; zoogY=mouseY+ (mouseY-zoogY)/30; float offcenter= mouseX-pmouseX; //draw Zoog's body stroke(0); fill(150); rect(zoogX,zoogY,20,50); //draw Zoog's head fill(255); ellipse (zoogX+10,zoogY-30,60,60); //draw Zoog's eyes fill(0); ellipse(zoogX+25,zoogY-30,16,32); ellipse(zoogX-7,zoogY-30,16,32); //draw Zoog's legs stroke(0); line (zoogX,zoogY+50, zoogX-10+offcenter,zoogY+60); line (zoogX+20,zoogY+50, zoogX+10+offcenter,zoogY+60); } void mrsticks(){ //make mrsticks chase zoog// mrsticksX= mrsticksX + (zoogX-mrsticksX)/150; mrsticksY= mrsticksY + (zoogY-mrsticksX)/150; if (dist(zoogX, zoogY, mrsticksX, mrsticksY)<10) {eat(); } //create mrsticks// ellipseMode (CENTER); rectMode (CENTER); stroke(0); fill(255,0,255); rect(mrsticksX, mrsticksY ,20,120); fill(0,0,255); rect(mrsticksX-20,mrsticksY+10, 20,60); fill (0,255,0); ellipse (mrsticksX, mrsticksY-50,60,60); triangle (0 } void scoring (){ } void eat() { //mrsticks beats zoog, take away 100 points// score= score - 100; background (0); zoogX= width/2; zoogY= height/2; mrsticksX= width/2; mrsticksY= height/2; } void gold() { ///the treasure if (goldY