I think you are taking it too hard.

Why not simply think like this:

  1. Simulate all possible next moves by same side
  2. If, in any resulting position in simulation, king is missing(captured) go to 4
  3. King is not in check
  4. King is in check

Why this works? Because if king is in check, it means if the same side plays again(plays double times) it can capture the king. So if it can capture the king by playing double moves, then it means opponent was in check.