Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Over Lapping Touches — Gideros Forum

Over Lapping Touches

zoolaxzoolax Member
edited January 2013 in General questions
Here it is the problem.

2 over lapping display objects.
And touches going through.
I have tried event:stopPropagation()
it stops all the particular event in my scenes.
I can think of couple of ways to fix it.

if obj:hitTestPoint(event.x,event.y)
and bottomObjWithIn(event.x ,event.y) ~= true

--do something

In corona you can just use " return true " ,
That prevents the touch of going through multiple objects.
That dose not respond in Gidros:)

I really like to know is there any easier way?
I have tried looking through the forums,
I could not find what I were looking for.

Thanks in advance.


  • OZAppsOZApps Guru
    Accepted Answer
    @zoolax, this feature of Gideros can be a blessing or a pain and I imagine you have got the latter.

    You can try to first find using the
    target = event:getTarget()
    x,y = event.x, event.y
    if target == theObj and
       target:hitTestPoint(x,y) == true then
    where theObj is the object that you want to test the touch for. There is another way where you can set the object.touch = true on the mouse_down and then check if the object has the touch started on it or not.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • @OZApps
    Thanks,That is simple ,and effective.
  • Just to follow slightly, I have a set of sprites within a group of sprites, so when I slide around it moves all the objects together, this is a touchdown touchmove and touchend attached to the group, nice effect, but if I dont move, and then release, I need to select the sprite under the finger, which is 1 level down.

    So I am at a cross roads, do I place this move event at the individual sprite level, and then try to pass the movement to the parent group? or do I leave it at the group level and pass it down to the sprite?
    My difficulty is trying to figure out how to pass this through in either direction.
    Would love to see an example.
    REAL programmers type copy con filename.exe
  • I am not totally sure on what you are trying to do.
    But from what I am getting;

    There are may ways,for example:
    1.Create a table and add all the sprites into that table
    2.add event listener to each sprite,so it will be selected on touch end and when I move it ,it moves that single sprite.
    3.create a separate function that loops through the table and move other sprite as well.
    put this function into the touch function so it will get activated as you touch the sprite.

    of course there are many ways.
Sign In or Register to comment.