Alpha masks (available from version 3.2852) allow complete freedom in determining the transparency for sprites. With alpha masking, each pixel of a sprite can have its own alpha value from 0 (fully transparent) to 255 (fully opaque). Mr. Iceblock provides an excellent example of what alpha masking can do.

Contents
Use
alphamask {path}
{path} Default: NA Path to a grayscale image (usually in PNG format) to be used as the alpha mask for the following frame or layer.
The usage of the alphamask command is exactly the same for both animations and background/foreground layers of levels.
Mask Format
Although the engine’s alpha masking functionality works fully, it has very specific requirements for alpha masks and their corresponding sprites. Although they don’t limit what you can do with alpha masking, they do limit the software that can be used to create masks. At the time of this writing, no suitable software is available, although it is in the works.
The requirements are as follows:
- The mask must have exactly the same width and height as its corresponding sprite.
- The transparent pixels in the sprite must match exactly with the fully transparent (grayscale value 0) pixels in the mask. Any transparent pixels in one image that aren’t transparent in the other will cause undefined behavior – anything from the mask not working to a complete engine crash.
Notes
- If you’re trying to conserve memory, use alpha masks only where they are absolutely necessary. Masked sprites take up twice as much memory as unmasked ones.
- Each alpha mask is only applied to the frame immediately following the alphamask command. If you want to use the same mask for multiple consecutive frames, you will have to use the alphamask command before each frame. This is different from how most other animation parameter commands work.
- Alpha masking can’t be mixed with other alpha effects from the alpha or drawmethod commands. If both are present, the alpha mask will override the other effect.