How do I stop an invisible layer from registering clicks?

Get help using Construct 2

Post » Tue Jun 17, 2014 4:56 pm

Hi,

So it seems that invisble layers in my game register touches/clicks all the same.
Can I prevent it?
B
16
S
7
G
1
Posts: 158
Reputation: 3,125

Post » Tue Jun 17, 2014 6:05 pm

Your could ad "Is Visible to the "on Click" conditions.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,283

Post » Tue Jun 17, 2014 8:56 pm

Unfortunately this doesn't cut it.

The two layers have buttons at the same places so it quickly becomes messed up when I click a button, the upper layer appears and immediately registers the same click.

I think there should be a live 'locked' property for layers or something like that.
B
16
S
7
G
1
Posts: 158
Reputation: 3,125

Post » Tue Jun 17, 2014 9:26 pm

In fact, here's a *.capx.

As you can see, the touch registers for the first event, then it meets another condition and is registered again for the second event.
I'm not sure how would i go around it.

Also, a simple 'else' might solve it in this example because it is very simble but in my project I have like 100 entangled events and 15 layers so it won't do the trick.
You do not have the required permissions to view the files attached to this post.
B
16
S
7
G
1
Posts: 158
Reputation: 3,125

Post » Tue Jun 17, 2014 9:36 pm

And here's a solution, if anyone's interested. This way the touch is registered only once instead of twice. The problem is still that it is a bit hacky... Relying on the order of events in C2 never seemed too elegant to me. Anyway, if anyone's got a better idea please let me know.
You do not have the required permissions to view the files attached to this post.
B
16
S
7
G
1
Posts: 158
Reputation: 3,125

Post » Tue Jun 17, 2014 10:44 pm

For some reason I cant download them. Create a global variable "Layer_Name_Is_Visible " Set the value to 0.
When the layer goes invisible change the value to 1.

Add the following condition to mouse click condition:

System > Layer_Name_Is_Visible =0
Mouse > on objects clicked
B
75
S
23
G
3
Posts: 673
Reputation: 9,283

Post » Wed Jun 18, 2014 8:31 am

Hi! it's a pity you can't download the attachments. As I've said I already solved the problem but just for the sake of clarity here's why the 'isVisible' condition won't work in this case:

Image

As you can see the upper layer stays always invisible (or stays always visible if I switch the conditions).
B
16
S
7
G
1
Posts: 158
Reputation: 3,125

Post » Wed Jun 18, 2014 8:46 am

If your buttons are sprites you could try disabling collisions on them when the corresponding layer becomes invisible
B
6
S
2
Posts: 79
Reputation: 608

Post » Wed Jun 18, 2014 8:47 am

another example...
MenuClicking.capx

And another way is you can also add buttons functionality to groups and enable/disable groups.
You do not have the required permissions to view the files attached to this post.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Wed Jun 18, 2014 6:52 pm

@DUTOIT
@monitz87

I don't think collisions affect clicks but I might be wrong. Disabling groups will be subject to the same problems as in the picture in my previous post. I've tried that. But I will have a look at this .capx!
B
16
S
7
G
1
Posts: 158
Reputation: 3,125

Next

Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 60 guests