I have a simple processing code that I'm trying to work with in python, but I keep getting syntax errors. Any help on changing the code would be greatly appreciated. Thanks.
void setup() { size(550, 500); noStroke(); smooth(); fill(255, 255, 255, 150); } //Square 1 vars int x1 = 5; int y1 = 10; int x1Speed = 2; int y1Speed = 2; //Square 2 Vars int x2 = 150; int y2 = 100; int x2Speed = 4; int y2Speed = 4; int size = 100; void draw() { background(180, 0, 0); drawSquare1(); drawSquare2(); checkCollision(); } void drawSquare1() { if(x1<0 || x1>width-size) { x1Speed = -x1Speed; } if(y1<0 || y1>height-size) { y1Speed = -y1Speed; } x1+= x1Speed; y1+= y1Speed; rect(x1, y1, size, size); } void drawSquare2() { if(x2<0 || x2>width-size) { x2Speed = -x2Speed; } if(y2<0 || y2>height-size) { y2Speed = -y2Speed; } x2+= x2Speed; y2+= y2Speed; rect(x2, y2, size, size); } void checkCollision() { if(abs(x1-x2) < size && abs(y1-y2) < size) { println("Collision"); //fill(255, 255, 255, 200); x1Speed=-x1Speed; x2Speed=-x2Speed; y1Speed=-y1Speed; y2Speed=-y2Speed; } else { fill(255, 255, 255, 100); }; } -- Erica Osher
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor