How do you change where a display object can be touched?

I have an image of a robot created with newImageRect, but I only want to trigger touch events on the robot’s head. But I haven’t found anything in the display API that would let me change this area without also changing the width of the image too.

How would you solve this?

https://docs.coronalabs.com/api/type/DisplayObject/isHitTestMasked.html
https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2016/08/hitmasking.zip

PS - Welcome to the community!

1 Like