0 Favourites

How do I disable layer input ?

  • Hello, I've encountered the following problem:

    <img src="http://oi39.tinypic.com/rabtrb.jpg" border="0" />

    I have a Pause Screen on a layer that is set to be invisible until the pause button is pressed. I also have a lot of objects in my game that can be touched. The problem is that I can touch the objects and the buttons regardless if the layer is visible or not.

    I've found this workaround:

    scirra.com/forum/suggestion-layer-input-option_topic65704.html

    But I would like to not be forced to add another condition (check if Pause Menu is visible) to any touchable object from my game.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Add all the touch events to a group then toggle it inactive when you show the pause menu

  • I've been running into this issue as well. There must be an easier way to deal with it. It's very annoying and seems like there should be an easy fix for it.

  • Create a variable we'll call it "canTouchDis", and set its initial value to "stop".

    Now make an on input event like on clicked, or on touched object, and then make a sub event that compares "canTouchDis" ="hammerTime", do the hammer dance.

    Then all you would need to do is make an event that changed stop to hammerTime in another event.

  • Taking my hat of and doing the hammer dance for newt ..

  • Ok, so there is no direct way to do this, only workarounds ?

    In that case I will probabbly use the Group Events method since I like to have a "clean code".

    Still, thanks newt for your method. I'm sure that will come in handy <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I ran into the same problem but I couldn't use the Group Events method (I learned something new though!). I use the same code for buttons that are on or not on the pause menu, so I would end up either disabling all the buttons or none of them.

    If anyone runs into this too, my workaround is to add the following conditions:

    On touched <object>

    AND <object> is visible

    AND Layer <object.LayerName> is visible

    This way, I don't have to be specific about what menu is showing or not (i.e. I can reuse the code in other projects.).

    I added my two cents to so I'm hoping we don't have to deal with these types of workarounds in the future. (Argh, I just realized there's a place I missed adding this workaround.)

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