combine lines from two files based on an if statement

I'm rather new to programming, and am attempting to combine lines from 2 files in a way that is way beyond my expertise - any help would be appreciated!

I need to take a file (file1) and add columns to it from another file (file2). However, a line from file2 should only be added to a given line in file1 if the number in file1column2 is between the numbers in file2column4 and file2column5. Therefore, I don't think I can use paste or join, and I can't figure out how to combine awk with getline or some if statement to get this to work. Any insight would be appreciated! Thanks so much!

file1

chr2L    22975381    -1.6723247    chr2L    22975381    -1.8917731    0.219448    0
chr2L    22975421    -1.526086    chr2L    22975421    -1.8669024    0.340816    0    
chr2L    22975458    -1.7168827    chr2L    22975458    -1.9361134    0.219231    0    

file2

2L    gadfly    exon    15748693    15748925    .    -    
2L    gadfly    exon    15748515    15748637    .    -    
2L    gadfly    exon    15746596    15748455    .    -

Based on your input, what is your expected output?

customize this based on your needs:

#!/bin/bash
> combined.txt
old_IFS=$IFS
IFS=$'\n'
for i in $(cat file1);do
    result=""
    for j in $(cat file2);do
        if [[ `echo $i |awk '{print $2}'` -gt `echo $j |awk '{print $4}'` && `echo $i |awk '{print $2}'` -lt `echo $j |awk '{print $5}'` ]];then
            result+="`echo $j|awk '{print $2}'`,"
        fi
    done
    result=`echo $result|sed 's/.$//'`
    echo $i $result >> combined.txt
done
IFS=$old_IFS

this will read file1 and file2 , compare them as what you said , and output combined result in combined.txt file.

a bit ugly, but:

nawk '
  FNR==NR{f2s[FNR]=$4; f2f[FNR]=$5; f2[$4,$5]=$0;next}
  {
     for(i=1;i in f2s;i++)
       if ($2>=f2s && $2<=f2f)
          print $0, f2[f2s, f2f]
  }' file2 file1