Good one, Marl!
Here's another example of using SetImageMask()
Save this image as MyImg.png in the media folder. (It includes the mask AND the bricks together, the code splits them)
SetVirtualResolution(800, 600)
` load in and separate the
` bullethole and bricks
MyImg = LoadImage("MyImg.png")
BulletImg = CopyImage(MyImg, 0, 0, 64, 64)
BrickImg = CopyImage(MyImg, 64, 0, 64, 64)
SetImageWrapU(BrickImg, 1)
SetImageWrapV(BrickImg, 1)
` make the brick background
backSpr = CreateSprite(BrickImg)
SetSpriteSize(backSpr, 800, 600)
SetSpriteUVScale(backSpr, .2, .2)
` this just makes a big white
` image using no external graphics
tempSprite = CreateSprite(0)
SetSpriteSize(tempSprite, 800, 600)
Render()
WallImg = GetImage(0, 0, 640, 550)
BlankWallImg = CopyImage(WallImg, 0, 0, 640, 550)
DeleteSprite(tempSprite)
WallSprite = CreateSprite(WallImg)
SetSpritePositionByOffset(WallSprite, 400, 350)
Do
Print("Tap to shoot")
If GetPointerPressed()
` clear the bulletholes
DeleteImage(WallImg)
CopyImage(WallImg, BlankWallImg, 0, 0, 640, 550)
` make more bulletholes
For x = 0 to 576 Step 64
SetImageMask(WallImg, BulletImg, 4, 4, x, Random(100, 300))
Sync()
t# = Timer()
While Timer() < t# + .05
Endwhile
Next x
Endif
Sync()
Loop