When doing object-to-background collision checks against solid blocks, it's usually sufficient to check for collisions only at the leading edge of the bounding box. By "leading edge" I mean the edge in the direction of movement.
What about when we want to detect overlap with some special tile type, such as water? The leading edge check can detect when the object enters such a tile, but we would still need to check the trailing edge to see when the object leaves the special tile. Alternatively we could scan tiles under the entire bounding box of the object to see which tile types it's overlapping.
So, which method is better? I think scanning the entire bounding box is easier to understand, but probably a tiny bit more inefficient. Maybe it doesn't matter much if the bounding box is small (as it usually is), though. Are there other things to consider here?
One other thing that comes to mind is that if special tiles are detected during ejection from a solid tile, they should be ignored, because the post-ejection position should be what matters.
EDIT: A really pedantic/generic implementation might also need a counter that is increased on enter and decreased when leaving (when counter is 0, not overlapping). Otherwise the object could possibly leave a special tile while still overlapping another special tile. EDIT2: Or maybe this isn't needed if the trailing edge check is only done if leading edge isn't still overlapping (like tokumaru suggested).
What about when we want to detect overlap with some special tile type, such as water? The leading edge check can detect when the object enters such a tile, but we would still need to check the trailing edge to see when the object leaves the special tile. Alternatively we could scan tiles under the entire bounding box of the object to see which tile types it's overlapping.
So, which method is better? I think scanning the entire bounding box is easier to understand, but probably a tiny bit more inefficient. Maybe it doesn't matter much if the bounding box is small (as it usually is), though. Are there other things to consider here?
One other thing that comes to mind is that if special tiles are detected during ejection from a solid tile, they should be ignored, because the post-ejection position should be what matters.
EDIT: A really pedantic/generic implementation might also need a counter that is increased on enter and decreased when leaving (when counter is 0, not overlapping). Otherwise the object could possibly leave a special tile while still overlapping another special tile. EDIT2: Or maybe this isn't needed if the trailing edge check is only done if leading edge isn't still overlapping (like tokumaru suggested).