// Bunte Bälle bewegen sich // Reflexion an den Wänden int ANZAHL = 10; Ball[] balls; void setup() { size(200,200); balls = new Ball[ANZAHL]; for (int i=0; i=0+r && xnew=0+r && ynew=width-r) { x = 2*(width-r)-x; y = ynew; vx = -vx; } if (ynew<0+r) { x = xnew; y = 2*r-y; vy = -vy; } if (ynew>=height-r) { x = xnew; y = 2*(height-r)-y; vy = -vy; } } } // ////////////////////////////////////////////////////////////