Modify a text file: $/LouisBall.java
$/LouisBall.java
String title= "School Playground"; float cloudX=0; float johnX, johnY; float mikeX, mikeY; float ballX, ballY=370; float barrier=370; //screen size void setup() { size( 500, 500); } // next frame void draw() { scenery(); people(); kickBall(); end(); } //background void scenery() { noStroke(); background( 70,150,250); fill(30,220,100); rect(0,height/1.8,width,height); // Sun. fill( 255,205,0 ); ellipse( 100, 90, 120,120 ); // clouds noStroke(); fill( 250,250,250 ); ellipse( cloudX-40, 80, 115,90 ); cloudX= (cloudX + 1/2) % width; fill( 250,250,250 ); ellipse( cloudX-40, 110, 165,90 ); cloudX= (cloudX + 2) % width; // school fill(168,140,90); rect(width/2.9,height/2.8,130,100); fill(0,0,0); rect(width/2.9,height/2.8,130,25); fill(30,80,60); rect(width/2,height/2.01,14.5,30); // soccer net fill(255); stroke(1); arc(width/2, height/1.4, 230, 180, PI, TWO_PI); } //people void people() { // john stroke(1); fill(150,50,250); rect(johnX-12,johnY+330, 25, 40); fill(168,140,90); ellipse(johnX,johnY+320,28,30); //mike fill(0,150,250); rect(mikeX-10,mikeY+30,20,40); fill(168,120,90); ellipse(mikeX,mikeY+30,17,20); //ball fill( 290,290,290 ); ellipse( ballX-10, ballY, 20,20 ); } //kick soccer ball void kickBall() { //move ball ballX = ballX + (mouseX-ballX) / 20; ballY = ballY + (mouseY - ballY) / 20; text( ballY, 10,10 ); if (ballY < barrier) ballY=barrier; float ballBottom= height-20; if (ballY > ballBottom) { ballY= ballBottom; //-- background(0); } //playing defence johnX = johnX +(ballX-johnX) / 30; if (johnX<150) johnX=150; if (johnX>300) johnX=300; //trying to score mikeX = mikeX +(ballX-mikeX) / 10; mikeY = mikeY +(ballY-mikeY) / 10; } //Poject Name void end(){ fill( 0 ); text( title, 20, height-20 ); }