How do I prevent hidden objects or layers to react to clicks

0 favourites
  • 4 posts
From the Asset Store
Make your game more fun and interactive with the Dog Hide and Seek Buttons Sprite Sheet.
  • Hi. I have some hidden objects and layers but they register touch and onclick events. So if an object is not visible it can still do something if you hit the spot or even if it is behind another object. Is it possible to disable this behavior so it does not get clicked if it is hidden behind another object or invisible?

    Someone told me I should "disable collision" but this did not work.

  • Just add a extra condition on the event you dont want triggered.

    condition

    "Object" Is Visible

    or if you need a whole layer I.e pause

    Add the system event Layer is Visible

    you can also add the condition is overlapping "otherobject" and invert it so it only works when not overlapping if that's what you need

  • Thank you very much! I thought about so much things but forgot to try the IsVisible condition. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I added a scrolling feature if you swipe or click and drag to scroll from top to bottom of the page (it moves all elements with dt*Touch.SpeedAt(0)). Some clickable objects are hidden behind the logo and navmenu on top. So I think I will try to set all objects with Y < X to invisible to prevent clicking on them and make them visible again if Y > X. Or does anyone have another idea how to do this?

    You can see it here: http://galciv3.bl4cksh33p.de (good example is on "Datenbank" in menu on top and then on "Medien / Wallpaper". When you scroll down, the images behind the navbar are clicked when you click on another menu item. Maybe "is overlapping object" does work, too?

    /Update: I added an inverted "is overlapping object" and it seems to work fine. The only "problem" is that images which are only partially shown are not clickable anymore because part of them is colliding/overlapping the tiled background on top (behind logo and navmenu).

    I think its ok for now but if anyone has an idea how to check if an image is partially behind an object or completely, I would be glad to hear your ideas.

    This works great for Sprites, but Textobjects have no "is overlapping" condition so I can't do it the same way for them. Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One more thing: the "is overlapping object" works fine in most cases (line 4) but in the example below (line 5) it does not work. It opens the URL even if it overlaps (is behind) the "Erfolge" sprite. Any ideas why? Clicking on the "MedienSprite" or "Erfolge" (both are overlapping) opens the webpage and jumps to a new layout at the same time.

    The "Erfolge" Sprites are on a global layer on another layout. Does collision check not work for this reason?

    The TiledBackground is on the same layout and works fine.

    And it seems hiding a layer does not hide the objects. (could be a feature or a bug, but I think it may be intended)

    The above code is executed even if the layer where the "Erfolge" sprite is on is hidden. So even if you cant see it the sprite it is "visible" as long as you dont hide them individually.

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