# How to detect sprite overlap in Godot?

I am trying to check for pixel-perfect overlap between my player sprite and my enemy sprite.

Because this kind of thing is computationally expensive, I only plan to do it if the bounding boxes of the sprites intersect.

Checking if the bounding boxes intersect is easy, but I'm not sure how to go about checking for sprite overlap.

In Pygame, you can easily create masks for each sprite and check for overlap using a simple collide_mask() method.

In Godot 3.0, it doesn't seem so straightforward.

How can I do this in Godot?

I can get the data from my Sprite's Texture in the form of an Image object, which has some potentially helpful methods, found here.

Maybe I need to construct some kind of mask from the image data, then translate the mask coordinates to world space. If I could do that, I could then check for overlap by comparing the coordinates of the player's mask and the enemy's mask. But I'm not sure how to go about this.

Note 1: I asked a variant of this question in a Godot forum, but didn't get a satisfying answer.

Note 2: I am not interested in creating complex polygons on top of the sprites, then checking the polygons for overlap. The sprites are animated, so a single polygon per animation wouldn't work.