Modify a text file: $/sunspots.java
$/sunspots.java
///SETUP declaring variables to shift sun across screen/// int xPos=250; float yPos=50; int sunr=200, sung=200, sunb=0; int skyr, skyg, skyb; boolean day=true; float spotDX, spotDY; void setup(){ ///SET SCREEN SIZE size(500, 500); } void draw(){ ///DRAW GRASS scene(); ship(); messages(); } void scene() { //// SCENE: sky, grass, sun, etc. background(skyr, skyg, skyb); // rect(0,0, 500,250); fill(0,100,0); ///DRAW SKY rect(0,250, 500, 250); //-- fill(200,200, 0); fill(sunr, sung, sunb); ///DRAW SUN AND SHIFT ACROSS SCREEN ellipse(xPos,yPos,50,50); // ANIMATE (sunspots); if (xPos % 90 == 0) { spotDX= random(-20, 20 ); spotDY= random(-20, 20 ); } if (xPos/90 % 2 == 0) { fill( sunr*0.5, sung*0.5, sunb*0.5 ); ellipse(xPos+spotDX, yPos+spotDY, 10,10); } // MOVE SUN xPos=xPos+5; // Sunset if (day) { skyr= 150; skyg= 200; skyb= 255; sunr=200; sung=200; sunb=0; } else { sunr= 150; sung= 150; sunb= 150; skyr=skyg=skyb=100; } if (xPos > width+20) { xPos= -20; yPos= yPos+25; /* if (day) { day= false; } else { day= true; } */ day= ! day; } scenery(); } void scenery() { fill(100,0,0); ///DRAW BOTTOM OF HOUSE rect(230,230, 75, 75); fill(200,0,0); ///DRAW ROOF OF HOUSE triangle(230,230, 267.5, 210, 305, 230); fill(155); ///DRAW MOUNTAIN triangle(350,250, 375, 200, 400, 250); fill(48, 139, 206); ///DRAW LAKE ellipse(100, 400, 300,105); fill(155); } ///DRAW SPACE SHIP void ship() { ellipse(50, 30, 95, 30); fill(0,0,0); ///DRAW ALIEN DUDE AND SET TO FOLLOW MOUSE// HAD TO SET HEAD HIGHER TO FLOAT/// fill(100,100,0); ellipse(mouseX, mouseY - 50, 50, 20); fill(100,100,0); ellipse(mouseX, mouseY, 75, 75); fill(48,139,206); strobes(); } ///ATTEMPTED TO MAKE STROBES FROM SPACE SHIP // COLORED STROBE APPEARS WHEN YOU HIT SPACE void strobes() { stroke(20,50,0); if (keyPressed == true) line(70, 70, 120, 270); stroke(20,50,0); line(50, 70, 60, 190); } void messages() { ///AUTHOR NAME textSize(16); text("by Jaclyn Barbato", 350, 400); }