Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Is it possible to move an image within the mask? I’ve set it up, but when I try to move the image the mask moves along with the image.

Sure! It's a bit of a weird setup, but you can use a regular function as the Transform argument to LayeredImageMask. Here's an example:

image fen_masked = LayeredImageMask("feniks", lambda x : At(x, adjust_crop), mask="mask2", background="bg2")
transform adjust_crop:
    animation
    crop (0, 0, 637, 431)
    linear 2.0 crop (1171-637, 950-431, 637, 431)
    linear 2.0 crop (0, 0, 637, 431)
    repeat
label start:
    "Start"
    show fen_masked at truecenter
    "Tada"
    show fen_masked sparkle animated right2
    "Sparkle"


The important part is the lambda - that's a function. You could also make a regular function that returns At(<img>, <transform>) yourself and set that as the second argument to LayeredImageMask. The `animation` property in the transform is also important so that the transform doesn't reset for every new expression change. Hope that helps!