Modify a text file: $/xMAQp2.p2.txt
$/xMAQp2.p2.txt
//// CST 112 Project #2 / Marcos Quijano //// String author= "Marcos Quijano"; String title= "Project #2"; float horizon; float x,y; // Position of sun. float sunX, sunY; void setup() { background( 20, 60, 170 ); size(600, 400 ); fill( 150, 150, 150 ); horizon= height / 2.75; // RESET: // Start the sun half-way across the screen. sunX= width/2.75; sunY= 50; } /// Draw: Trees void draw() { fill( 100, 50, 0 ); rect( 295, 90, 10, 60 ); fill( 200, 300, 0 ); ellipse( 300, 100, 50, 50 ); fill( 100, 50, 0 ); rect( 350, 90, 10, 60 ); fill( 200, 300, 0 ); ellipse( 355, 100, 50, 50 ); fill( 100, 50, 0 ); rect( 495, 90, 10, 60 ); fill( 200, 300, 0 ); ellipse( 500, 100, 50, 50 ); /// Draw: Grass fill(50,160,50); rect(0, horizon,width,height+horizon); /// Draw: Rover fill( 120, 120, 120 ); rect( 200, 170, 50, 30 ); rect( 240, 160, 30, 20 ); rect( 230, 160, 20, 10 ); fill( 300, 300, 300 ); ellipse( 260, 170, 10, 10 ); fill( 0, 0, 0 ); ellipse( 260, 170, 2, 2); /// Draw: House fill( 150, 150, 150 ); rect( 100,100, 100,50 ); rect( 130,50, 15,50); triangle( 100,100, 200,100, 150,60 ); fill( 0, 0, 0); rect( 110,110, 30,40); /// Draw: Monster fill(0, 0, 0); rect(400,300, 30,60); ellipse(415,290,40,40); fill(300, 300, 300); ellipse(415,290, 20,20); fill(0, 0, 0); ellipse(415,290, 5,5); rect(370,305, 40,5); rect(370,315, 40,5); rect(405,340, 5,40); rect(420,340, 5,40); /// Draw: Human fill(300, 300, 200); rect(380,105, 20,5); rect(430,105, 20,5); rect(405,140, 5,30); rect(420,140, 5,30); fill(255, 0, 0); rect(400,100, 30,50); fill(300, 300, 200); ellipse(415,90,40,40); fill(300, 300, 300); ellipse(410,90, 10,10); ellipse(420,90, 10,10); fill(0, 0, 0); ellipse(410,90, 2,2); ellipse(420,90, 2,2); /// Draw: Sunset fill( 255,150,0); ellipse( sunX,sunY, 50,50); // ACTION: setting sun crosses sky, reset to right side. if (sunX > width) { sunX = 1; } sunX = sunX + 2; }