Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
touchable areas of an on-screen object — Gideros Forum

touchable areas of an on-screen object

nicknick Member
edited November 2012 in General questions
Hi all,

I'm wondering whether/how the following could be implemented in Gideros: image objects on screen where where only touches to a certain part of the image are being detected (e.g. only the non-transparent parts of a PNG).

In Corona I found two basic ways to do it: 1) (preferred) using a Bitmap Mask and set the object.isHitTestMasked property to true. or 2) using physics shapes

How would these transfer to the Gideros world?

Dislikes: Yan

+1 -1 (+0 / -1 )Share on Facebook


  • petecpetec Member
    Accepted Answer
    If I need only part of an image to respond to a touch I do it by adding a second 'target' shape over the part of the image I want to receive the touch, set the alpha of that to 0 and test for when the target shape is touched rather than the image. The touch area still can't be exact shape of the image, but then neither is the finger touching it. I usually find that I can get accurate enough with that. I often set the alpha of the target shape to 0.5 while I'm positioning it to check that it's where I want it. All a bit clunky, but it works for me!

    Likes: hgvyas123

    +1 -1 (+1 / -0 )Share on Facebook
  • Thanks for the response! Actually, I do have quite a bunch of (unique) objects per scene (about 50+). But in fact creating shapes out of the sprites and creating a spritesheet from it should be a snap with PhysicsEditor. Will probably go with that. Thanks!
  • at the another end if your objects are like circle means not much transparent pixel then it will be fine to keep the touch area as rectangle you can trim the images in very good way also you can ignore the touch at the border with some little math both of this method will be fine as all the users using fingers and hence it is event hard for them to see where they have touched exactly :D

    but if your object are like triangle you dont have any option unless creating shape for now

Sign In or Register to comment.