Hi All,
I have a physics body with a touch listener and have grouped under it another image, which I don’t want to be touchable.
As it stands the child image which is bigger than the parent is triggering the touch event.
Can I switch this childs contribution to the touchable area of the group off.
Hope this makes sense.
Thanks
[import]uid: 35156 topic_id: 7847 reply_id: 307847[/import]
This could work.
[code]
–image…
image.isTouchable = false --Assign whether the image should respond to touch events
–imageiWantToTouch
imageiWantToTouch.isTouchable = true --Assign whether the image should respond to touch events
–Then in your listener…
local function touched(event)
–if the image is touchable then execute required actions
if event.phase == “began” and event.target.isTouchable == true then
–do whatever
end
[/code] [import]uid: 6981 topic_id: 7847 reply_id: 28038[/import]
Hi,
Thanks for the reply,
I have tried this but as soon as you group another image underneath an object with a touch listener
that image becomes touchable regardless.
What I am trying to do is to get the effect of a rolling ball by grouping a dirt texture underneath a physics body , translating and masking the dirt texture separately. This is all working fine except that It becomes touchable even when masked.
The hierarchy is as follows:
BallBody
BallImage BallDirtGroup( Display Group with Mask)
|
|
Ball Dirt Image which is translated relative the the movement of the ballImage
I think I have hit a brick wall with this one…
Thanks
[import]uid: 35156 topic_id: 7847 reply_id: 29250[/import]