class Cube { int xx; int yy; int xDir; int yDir; Cube (int x_, int y_, int xDir_, int yDir_) { xx = x_; yy = y_; xDir = xDir_; yDir = yDir_; } void move() { xx = xx + xDir; yy = yy + yDir; if (xx > width || xx < 0) { xDir = xDir * -1; } if (yy > height || yy < 0) { yDir = yDir * -1; } } void display() { move(); fill(255,xx,yy); rect(xx,yy,5,150); } }