[Request] Disable Touch

Discussion and feedback on Construct 2

Post » Thu Jan 30, 2014 11:33 pm

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.
B
14
S
2
Posts: 39
Reputation: 689

Post » Thu Jan 30, 2014 11:43 pm

This is easily fixed using a variable as a Boolean.
Have you tried searching the forum for a solution?
Image ImageImage
B
168
S
50
G
163
Posts: 8,221
Reputation: 105,061

Post » Fri Jan 31, 2014 12:08 am

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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,552

Post » Fri Jan 31, 2014 1:09 am

@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.danialgoodwin2014-01-31 01:09:44
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Tue Apr 29, 2014 11:18 pm

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.
B
14
S
2
Posts: 39
Reputation: 689

Post » Wed Apr 30, 2014 1:08 am

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.
Image ImageImage
B
168
S
50
G
163
Posts: 8,221
Reputation: 105,061

Post » Wed Apr 30, 2014 4:29 am

That was in my original description :) "I have simple work around using a global variable that is either 1 or 0 "
B
14
S
2
Posts: 39
Reputation: 689


Return to Construct 2 General

Who is online

Users browsing this forum: Colludium and 5 guests