Sounds like you are having trouble making cars go off one end of the screen and then appear at the other end of the screen. A neat trick to deal with this is to just draw each car twice, and correct the position of any car that has gone past the edge.
Example:
class Foo {
float px, py, vx;
color c;
Foo(float ipy) {
px = random(width);
vx = random(0.5,10);
py = ipy;
c = color(random(255), random(255), random(255));
}
void draw() {
px+=vx;
px%=width;
fill(c);
rect(px, py, 20, 20);
rect(px-width, py, 20, 20);
}
}
ArrayList<Foo> foos = new ArrayList();
void setup() {
size(600, 600);
for (int i=0; i<30; foos.add(new Foo((i++)*20)));
}
void draw() {
background(0);
for (int i=0; i<30; foos.get(i++).draw());
}