You could try to get the angle of the line and then get the Z value of the aprite and get the intersection of the two lines, then not let the sprite past that point