Also, you can do this if it suits your situation:
You can create an image that has a visible part, an invisible part, and a transparent part.
Huh? invisible is not transparent?
Lets assume the background for your game is black (for simplicity).
Create the image with the visible portions whatever color you wish and the invisible portions with the color black (0, 0, 0). Set the transparent portions to almost black (1, 1, 1) (or any color you wish as long as you know exactly which).
In your program, set the mask color for the color 1, 1, 1 (or whatever color you chose earlier)
When you check for a collision with ImagesCollide, the invisible portions (0, 0, 0) will collide but the transparent portions (1, 1, 1) will not and the player will not be able see either.
You can create an image that has a visible part, an invisible part, and a transparent part.
Huh? invisible is not transparent?
Lets assume the background for your game is black (for simplicity).
Create the image with the visible portions whatever color you wish and the invisible portions with the color black (0, 0, 0). Set the transparent portions to almost black (1, 1, 1) (or any color you wish as long as you know exactly which).
In your program, set the mask color for the color 1, 1, 1 (or whatever color you chose earlier)
When you check for a collision with ImagesCollide, the invisible portions (0, 0, 0) will collide but the transparent portions (1, 1, 1) will not and the player will not be able see either.