Collisions on moving objects

Okay I now have this:

float stripeYPos;
float b;
float obstacleYPos;
float obstacleXPos;

float carXPos;
float carYPos;

float d;

int x = 0;
int y = 450;

void setup() {
size (720, 600);
stripeYPos = -40;
obstacleYPos = -80;
b = -70;
obstacleXPos = x;

carXPos = 0;

//fill (#626161);
//rect (0, 0, 240, 600); // links weg

//fill (#F7F7F7);
//rect (240, 0, 240, 600); // midden weg

//fill (#626161);
//rect (480, 0, 240, 600); // rechts weg
}

void keyPressed() {
if ( key == ‘d’ ) {
x = x + 50;
}
if ( key == ‘a’)
x = x - 50;
}

void draw () {
background (#484646);
smooth();
strokeWeight(2);

line(240, 0, 240, 600);
line(480, 0, 480, 600);

//if (dist(carXPos, y, obstacleXPos, obstacleYPos) < 3) {
// background (0);
// noLoop();
//}

if(abs(x-obstacleXPos) < 100)

obstacleYPos = obstacleYPos + 8;
if (obstacleYPos > height) {
obstacleYPos = -20;
}

stripeYPos = stripeYPos + 5;
if (stripeYPos > height + 70) {
stripeYPos = -20;
}

fill (#F7F7F7);
rect(100, stripeYPos, 40, 70); // all the moving stripes

rect(340, stripeYPos, 40, 70);

rect(580, stripeYPos, 40, 70);

fill(255);
ellipse(obstacleXPos + 400, obstacleYPos, 72, 72); // Obstacle circle

fill (#F20F0F);
rect(obstacleXPos + 100, obstacleYPos, 80, 80); // obstacle rectangle

fill (#F00F0F);
rect(x+5, y-12, 50, 20); //x,y,w,h body

fill (#F00F0F);
rect(x+5, y+60, 50, 20); //x,y,w,h body

fill (#F00F0F);
rect(x + carXPos, y-5, 60, 80); //x,y,w,h car

fill (#050505);
rect(x-15, y+2, 15, 25); // top left tire

fill (#050505);
rect(x-15, y+40, 15, 25); // bottom left tire

fill (#050505);
rect(x+60, y+2, 15, 25); // top right tire

fill (#050505);
rect(x+60, y+40, 15, 25); // bottom right tire
}

But it still doesn’t do what I want it to do, It only has to stop when the objects hit eacother