Masking + Buttons maskX maskY

Since Graphics 2.0 basically halted development of my game, I’ve been a little nervous to come back to it.

I recently tried to fix an issue with hit-testable areas of buttons and ran into some confusion.

Making the masks the same size as the graphics (roughly, with multiples of 4), I noticed that I had to do some strange adjustments to maskX and maskY that I don’t understand. 

My test project is attached, with graphics and masks. Why do I have to adjust the maskX to 214 and maskY to 103 to make the masks “fit”? How does that math work and why?

Hi @jack95,

The positioning of x and y for the mask allow you to adjust (slightly) the positioning of the mask (its center) on the object (its center), so at a quick glance, 214 and 103 seems logical since that’s half of your button “windows” (each about 428 x 206 by my measurement).

Also, I notice your masks don’t have 3 pixels black border all around… maybe 2 pixels on most sides. The docs state you should use at least 3 pixels, and I suggest going even a bit more just to be safe.

Brent

I guess the borders got squished from the original sizes. That makes sense.

Thx for the clarification on the maskX and maskY!

Hi @jack95,

The positioning of x and y for the mask allow you to adjust (slightly) the positioning of the mask (its center) on the object (its center), so at a quick glance, 214 and 103 seems logical since that’s half of your button “windows” (each about 428 x 206 by my measurement).

Also, I notice your masks don’t have 3 pixels black border all around… maybe 2 pixels on most sides. The docs state you should use at least 3 pixels, and I suggest going even a bit more just to be safe.

Brent

I guess the borders got squished from the original sizes. That makes sense.

Thx for the clarification on the maskX and maskY!