Need help with dist()

So you have code that checks collision with edges. Check of collision with the wall is similar, but you have to check both x and y values. And you have to keep in mind that there are four walls your object can collide to, so four if clauses, right.

Next if clause would check if object is about to hit the left wall. I assumed that coordinates of top left corner of rectangle are wall1X and wall1Y and lower right corner are wall2X and wall2Y

if(yPosChell >= wall1Y && yPosChell <= wall2Y && xPosChell >= wallx1 - 10 && xPosChell <= wallx1) {
   .....
}

First two term check if y-coordinate is between rectangles top and bottom. They tell if object is either on the left side or right side of the rectangle. Last two terms check if object is no more than 10 pixels away on the left side of the rectangle.