[Suggestion] Layer input Option

Discussion and feedback on Construct 2

Post » Sun Mar 31, 2013 2:14 pm

Hi,

i guess this question is aimed @Ashley really.

Is it possible or viable to add an option to the Layers properties to disable input on that layer. It would make it so much easier if you could hide a layer and also disable any mouse clicks, touch or keyboard events related to that layer/layers.

Thanks
B
45
S
15
G
9
Posts: 1,096
Reputation: 11,038

Post » Sun Mar 31, 2013 6:31 pm

You mean during runtime, design time has the little locks. I currently add a condition to my events like: "Is layer visible?" that way if it's hidden, the clicks don't fire. But if that ability was there, I would definitely use it.
B
201
S
52
G
30
Posts: 897
Reputation: 36,621

Post » Sun Mar 31, 2013 10:02 pm

At edittime: this is already supported

At runtime: why not just add a condition to the event detecting input? E.g. if you have 'On object clicked', add a 'Object is on layer X' and 'Is global variable LayerXEnabled = 1'.Ashley2013-03-31 22:02:33
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon Apr 01, 2013 12:05 am

I did mean at runtime actually. At the moment even if the layer is hidden any object getting input such as a mouse click or cursor over etc still gets it.

I already use workrounds but it means every input needs to be qualified.

B
45
S
15
G
9
Posts: 1,096
Reputation: 11,038

Post » Mon Apr 01, 2013 3:12 am

I don't think this is a feature that will be needed widely enough to implement. Just my opinion.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Thu Apr 25, 2013 2:01 pm

I have to work around this problem all of the time - I'm sure others do too. In the majority of cases you don't want hidden layers to be active with Touch or Mouse.

Would be perfect to have a 'Touch/Mouse Input when hidden' enabled/disabled option on layer settings. Save so much hassle.

Ideally, should have this option for hidden objects too.

Regards, Anthony.
B
5
Posts: 18
Reputation: 821

Post » Thu Apr 25, 2013 3:01 pm

To solve this, could the system regard all objects in the same layer as a subjective kind of "Family"? So you could activate all functions that usually regard a family using the specific Layer name you want to affect/disable/enable.
B
11
Posts: 17
Reputation: 909

Post » Thu Apr 25, 2013 3:23 pm

It's quite easy to do actually

+System: Layer "menu" is visible
++ do your event
++ Mouse: On Left button clicked,
++ Keyboard: On any key pressed
++ anything

That way those events will be valid only if actual layer is visible.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Thu Apr 25, 2013 5:36 pm

@shinkan

doing it that way means turning off all layers other than the one you want to accept the input which is not always desired.

If i have a game layer and layer with a menu on. I should just be able to make the menu visible without having to make other layers invisible.

It may be difficult or break other things i dont know but it seems logical to me to have a simple toggle which disables all input to a selected layer or layers.
B
45
S
15
G
9
Posts: 1,096
Reputation: 11,038

Post » Tue Dec 16, 2014 12:37 pm

I agree with @spongehammer and would like to make a similar suggestion.

I finally figured out how to work around the issue by simply adding two conditions to my input events:

On touched <object>
AND <object> is visible
AND Layer <object.LayerName> is visible

However, I would like Construct 2 to automatically take care of this for me for the reasons that follow. The solution could be to make invisible objects or layers not respond to input events, or have an Enabled property that governs that.

Why I'm making this suggestion:
1. To keep the code clean and simple. Users shouldn't have to add additional conditions to every touch/input event.
2. This is a trap for bugs. Looking at the forum posts, there are people who run into this and are puzzled. They tend to think invisible objects should be treated as if they're not there. After all, the game player wouldn't see anything to touch or click. A "pause layer" that covers the game is one possibly common way to run into this problem.
3. As simple as the workaround may be, it still took me a good amount of time searching for forums to understand the issue and look for a fix. I'm sure Scirra wants to let its users focus on developing the game play, not these finicky details.

If you don't take this suggestion, could you please at least mention in the reference manual that the touch events *do* fire for invisible objects or and objects on invisible layers? That way at least we are warned.

Thanks for reading.
B
4
Posts: 2
Reputation: 204

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests