A question about wack-a-mole games

Like the wack-a-mole game in this link. How does it manage to have the mole vanish inside the hole? It obviously doesn’t have enough space for the entire mole to hide down there if I want to use another sprite to cover it up. And making the mole and background different layers would not help, since the bottom of the mole is below the background but the top of it is on top of the background.

I’m very appreciated if anyone can help><.

Pretty sure they are 3D models that pop up from under the other model that is the “board”. The holes are black meshes too so the moles are not visible under them.

If you stop the video at a time when the mole’s helmet is poking through the black “film” of a hole, you can see the ~10 sides of the helmet mesh (it’s not perfectly round)

You can do the same with 2D as explained in the comments. Here’s an image to explain it better

Of course you need to close the gaps to make it look like 1 image.