Is this a bug? z-index problem

0 favourites
  • 3 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • When the sprite is touched it should go to the top and you can drag it.

    When I place the blue box on the pink box, let go, then select it again, it works fine.

    But, when I select the pink box, it goes to top like it should, I drag it on top of the blue box and let go. Good. Then when I touch the pink box, the blue box gets brought to the top (why?). When I drag, it's the pink box that gets dragged (which is correct, but the blue box should not have been brought to the top, over the pink).

    cp3 file: 1drv.ms/u/s!AobC4q3rBlr6x_MUEJM-QxF3I1uZGg

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • that is not a bug.

    when you use touch, all objects touched will get triggered. Your event sheet checks the pink one first, then the blue one second. Since it is the last one checked, it is the last one to get moved to the top, even through the pink one is getting dragged. Drag and drop will pick the top instance, but any other objects will know that they were touched as well. Even if they are not visible, or on a layer that is not visible.

    what I normally do is put objects that respond to touch commands in a family, and then check for "on touched object" for the family, then have a sub event pick the top instance.

  • that is not a bug.

    when you use touch, all objects touched will get triggered. Your event sheet checks the pink one first, then the blue one second. Since it is the last one checked, it is the last one to get moved to the top, even through the pink one is getting dragged. Drag and drop will pick the top instance, but any other objects will know that they were touched as well. Even if they are not visible, or on a layer that is not visible.

    what I normally do is put objects that respond to touch commands in a family, and then check for "on touched object" for the family, then have a sub event pick the top instance.

    Thanks, that makes sense. However, putting them into the family had the same result. I got around it by moving the objects to the top on DragDrop start, and then it worked.

    Thanks :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)