//Dennis Malcolm class Paddle { float d; // diameter float x; // x position float y; // y position // float sx; // speed in x direction float sy; // speed in y direction float dx; // x direction, must be 1 or -1 float dy; // y direction, must be 1 or -1 Paddle() { // populate the arrays with initial values d = 20; x = (-1); y = (-1); // sx = random(20); sy = random(20); // dx = (boolean(round(random(1)))) ? 1 : -1; dy = (boolean(round(random(1)))) ? 1 : -1; } void display() { // draw the Paddle smooth(); fill(255); rect(x, y, d, 80); } void move() { // increment x and y by speeds and apply direction // x += sx * dx; y += sy * dy; // test for x values less than zero and greater than width // if true, then reverse direction of x // if (x <= 0) // { // dx = 1; // } // else if (x >= width) // { // dx = -1; // } // test for y values less than zero and greater than height // if true, then reverse direction of y if (y <= 0) { dy = 1; } else if (y >= 420) { dy = -1; } } }