My screen is 320x480. My mask file, mask.png
is 320x480 with some white, black and slightly opaque black parts. When I set a mask on a display group, the mask is way off. Even though it says it’s maskX and maskY is 0 and 0, I can only see the whole part of my masked display group when I move the mask to 160,240 (the center of my screen)
And how come I can’t set the alpha of images inside my display group, but I can set the alpha to other display objects?
\_W = display.contentWidth
\_H = display.contentHeight
local dg = display.newGroup()
local mask = graphics.newMask('mask.png')
dg:setMask(mask)
print (dg.maskX,dg.maskY) -- maskX and maskY are 0 and 0 but...
dg.maskX = 160 -- i have to set this
dg.maskY = 240 -- and this to the center of the screen
-- otherwise i only see the top left corner of the mask
-- as if the default maskX and maskY are -160 and -240
-- even though printing them shows 0 and 0!
local rect = display.newRect(dg,0,0,\_W,\_H)
rect.alpha = .5 -- the rect I draw can have its alpha adjusted
local box = display.newImage(dg,'box.png',20,20)
box.alpha = .5 -- the image I draw can NOT have its alpha adjusted???
box.png
mask.png
[import]uid: 213270 topic_id: 36144 reply_id: 336144[/import]