//Philip Paniccia //9-10-14 //Soccer Goals int x,y; // Field coords int ballX, ballY; int ballDX, ballDY; void setup() { // Setup // size(500,250); x= width/2; y= height/2; ballX= x; ballY= y; ballDX=2; ballDY=1; } void draw() { // Next frame // background(0,150,0); field(); ball(); text( ballX, 10,10 ); text( ballDX, 10,20 ); } void ball() { // Move & draw Ball if (ballX > width-20 || ballX<20) { ballDX = - ballDX; } ballX= ballX + ballDX; // draw ball stroke(0); strokeWeight(2); fill(255); ellipse( ballX, ballY, 5,5); } void field() { //Field // //drawing Center line, large ellipse, small ellipse stroke(255); strokeWeight(2); line(250,0,250,250); stroke(255); strokeWeight(2); fill(0,0,0,0); stroke(255); //Midfield strokeWeight(2); ellipse(x,y,30,30); fill(255); ellipse(x,y,5,5); //Drawing 18 yard line, 6 yard line stroke(255); strokeWeight(2); fill(0,0,0,0); //Right side of field rect(x+175,y-75,100,150); rect(x+215,y-50,75,100); //Drawing 18 yard line, 6 yard line stroke(255); strokeWeight(2); fill(0,0,0,0); //Left side of field rect(x-275,y-75,100,150); rect(x-290,y-50,75,100); }