Modify a text file: $/xMAQp1.pde
$/xMAQp1.pde
//// moon moves across the sky float x,y; // Position of moon. float moonX, moonY; //// SETUP: Define screen size, set modes. void setup() { size( 500, 300 ); // RESET: // Start the moon half-way across the screen. moonX= width/2; moonY= 50; } //// DRAW: sky & moon & tree void draw() { // SCENE: sky, moon, house. background( 0, 0, 0 ); fill( 150, 150, 150 ); ellipse( moonX, moonY, 60,60 ); fill( 0, 255, 0 ); rect( 100,100, 100,50 ); rect( 130,50, 15,40); triangle( 100,100, 200,100, 170,60 ); fill( 255, 0, 0); rect( 110,110, 30,40); fill( 100, 50, 0); rect( 295, 90, 10,60); fill( 200, 300, 0); ellipse( 300,100, 50,50); // ACTION: moon crosses sky, reset to right side. if (moonX > width) { moonX= 1; } moonX= moonX + 2; // MESSAGES. fill(0); text( "moon moves across the sky.", width/4, 30 ); // Also display the author and file name. text( "M.A.Quijano / dynamic1.java", 10, height-10 ); }