function hitDetect(a,b){
  if(a.x>=b.x && a.x<=b.x+b.w && a.y>=b.y && a.y<=b.y+b.h){
    return 1;
  }
  if(a.x+a.w>=b.x && a.x+a.w<=b.x+b.w && a.y>=b.y && a.y<=b.y+b.h){
    return 2;
  }
  if(a.x>=b.x && a.x<=b.x+b.w && a.y+a.h>=b.y && a.y+a.h<=b.y+b.h){
    return 3;
  }
  if(a.x+a.w>=b.x && a.x+a.w<=b.x+b.w && a.y+a.h>=b.y && a.y+a.h<=b.y+b.h){
    return 4;
  }
  return 0;
}
//Step 11: Create a function to detect if two rectangles are colliding
Step 11: Create a function to detect if two rectangles are colliding
Step 11 : Create a function to detect if two rectangles are colliding
function hitDetect(a,b){
  if(a.x>=b.x && a.x<=b.x+b.w && a.y>=b.y && a.y<=b.y+b.h){
    return 1;
  }
  if(a.x+a.w>=b.x && a.x+a.w<=b.x+b.w && a.y>=b.y && a.y<=b.y+b.h){
    return 2;
  }
  if(a.x>=b.x && a.x<=b.x+b.w && a.y+a.h>=b.y && a.y+a.h<=b.y+b.h){
    return 3;
  }
  if(a.x+a.w>=b.x && a.x+a.w<=b.x+b.w && a.y+a.h>=b.y && a.y+a.h<=b.y+b.h){
    return 4;
  }
  return 0;
}
function hitDetect ( a , b ) { if ( a . x >= b . x && a . x <= b . x + b . w && a . y >= b . y && a . y <= b . y + b . h ) { return 1 ; } if ( a . x + a . w >= b . x && a . x + a . w <= b . x + b . w && a . y >= b . y && a . y <= b . y + b . h ) { return 2 ; } if ( a . x >= b . x && a . x <= b . x + b . w && a . y + a . h >= b . y && a . y + a . h <= b . y + b . h ) { return 3 ; } if ( a . x + a . w >= b . x && a . x + a . w <= b . x + b . w && a . y + a . h >= b . y && a . y + a . h <= b . y + b . h ) { return 4 ; } return 0 ; }
Step 11: Create a function to detect if two rectangles are colliding
Step 11 : Create a function to detect if two rectangles are colliding