[Request] Disable Touch

0 favourites
  • 7 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • I have encountered this quite a few different times, mostly when spawned buttons overlap other buttons on different layers. Since there is no disable touch feature both buttons get clicked at the same time. I have simple work around using a global variable that is either 1 or 0 and then for all touch events (this feature would reduce the massive amount of repetitive code) I have an additional condition that the global variable has to be 0 where as my unique events I don't want touch to work I set the variable to 1 and when I do want touch to work I set it back to 0.

    This would be highly valuable to have a simple function that disables touch and most likely you would attach it to a family of objects you want to disable during some key event.

  • This is easily fixed using a variable as a Boolean.

    Have you tried searching the forum for a solution?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Put the click/touch events from a certain layer below/in a group.

    then disable or enable the group s needed.

    Is layer visible, could be added to events to check if the layer they are on is actually visible.

  • kenn, here's a few more ideas to solve this issue:

    • If all the buttons are in a Family, or at at least in a single click event, then you can use the System condition called "Pick nth instance". The 0th instance should be the one on top.
    • It sounds like the buttons are spawning randomly in order to cause the overlapping. Maybe you would rather create different spawn points for the buttons so that they don't overlap? Or, you could delete the button if it is overlapping another button, and spawn it again until it isn't overlapping.

    But, I think the first solution I gave should be the easiest to implement.

  • Thanks for the responses. I definitely searched the forum but did not find any direct solutions to what I was encountering.

    I have not tried a boolean solution but am not sure how I would apply that.

    The thing about nth touch or instance won't work for me. The use case is game navigation in the upper left hand corner. They click one of the main menu items to go back home, when they do so I overlay two options (continue, or save and quit) those spawned buttons/sprites are overlapping other buttons on the screen. So when those are active I want to disable all other buttons in a systematic way - I could do a global variable but for the number of sprites and levels I have it would be extremely repetitive.

  • Using 1, or 0 is a Boolean.

    For multiple objects you can try instancing by setting instance variables that way, or if you must have different objects use a family variable.

    Otherwise you could make a behavior, which is a bit of overkill.

  • That was in my original description "I have simple work around using a global variable that is either 1 or 0 "

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