Modify a text file: $/x205Vega.pde
$/x205Vega.pde
//Making values for each square. float x1 = 20, y1 = 20; float x2 = 380, y2 = 20; float x3 = 380, y3 = 380; float x4 = 20, y4 = 380; void setup() { size(500, 500); } //Setting background, text, and calling each function. void draw() { background(255); text("Watch the circles.", 200, 250); square1(); square2(); square3(); square4(); } /*Functions to make squares move, using equal statements to make sure they constantly move around.*/ void square1() { fill(255, 0, 255); rect(x1, y1, 100, 100); if (x1 != 380 && y1 == 20) { x1+=5; } else if (x1 == 380 && y1 != 380) { y1+=5; } else if (x1 != 20 && y1 == 380) { x1-=5; } else if (x1 == 20 && y1 != 20) { y1-=5; } } void square2() { fill(255, 0, 255); rect(x2, y2, 100, 100); if (x2 == 380 && y2 != 380) { y2+=5; } else if (x2 != 20 && y2 == 380) { x2-=5; } else if (x2 == 20 && y2 != 20) { y2-=5; } else if (x2 != 380 && y2 == 20) { x2+=5; } } void square3() { fill(255, 0, 255); rect(x3, y3, 100, 100); if (x2 != 20 && y2 == 380) { x2-=5; } else if (x2 == 20 && y2 != 20) { y2-=5; } else if (x2 != 380 && y2 == 20) { x2+=5; } else if (x2 == 380 && y2 != 380) { y2+=5; } } void square4() { fill(255, 0, 255); rect(x4, y4, 100, 100); y4-=1; }