How do I stop an invisible layer from registering clicks?

Get help using Construct 2

Post » Thu Jun 19, 2014 4:44 am

pirx wrote:@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!


Actually, after I posted my reply I had the same question: "do touch events take hitboxes into account or the actual sprite image?"... I think it is worth testing at least.

Groups should be different because you can put all the events involving a certain layer into a group, and disable said group when its associated layer is invisible, so you won't get those 'my click triggered events on various layers' problems, because all events on an invisible layer would be disabled.
B
6
S
2
Posts: 79
Reputation: 608

Post » Thu Jun 19, 2014 6:24 am

@pirx, Yes collisions affect clicks - lol. That is the hitbox as monitz87 says. But it isn't a solution as you usually want the whole button to be clickable.

Groups work, it just isn't the best way to do it. I used it on a previous project, but it takes some out the box thinking.
The capx I posted is a nice work-a-round. There are other ways too - lots of ways, actually.
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 » Thu Jun 19, 2014 6:58 am

DUTOIT wrote:@pirx, Yes collisions affect clicks - lol. That is the hitbox as monitz87 says. But it isn't a solution as you usually want the whole button to be clickable.


I never suggested altering the button's collision polygon, I just said he should disable collisions on buttons which belong to invisible layers (and enable them when the corresponding layer becomes visible), so they don't register "On Click" events, which would basically solve his problem.
B
6
S
2
Posts: 79
Reputation: 608

Post » Thu Jun 19, 2014 9:04 am

monitz87 wrote:
DUTOIT wrote:@pirx, Yes collisions affect clicks - lol. That is the hitbox as monitz87 says. But it isn't a solution as you usually want the whole button to be clickable.


I never suggested altering the button's collision polygon, I just said he should disable collisions on buttons which belong to invisible layers (and enable them when the corresponding layer becomes visible), so they don't register "On Click" events, which would basically solve his problem.


;)
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 » Sat Aug 09, 2014 4:28 pm

Hi. I tried to disable collisions for the invisible layers but it seems they are still blocking a click on the current layer. o.O (r176)
Image
B
53
S
16
G
6
Posts: 718
Reputation: 9,150

Post » Sat Aug 16, 2014 7:28 pm

Is there no way to let invisible layers act like there were not there? (all objects not registering/blocking clicks)?
I used some invisble layers for UI menus because its easier to just show/hide a layer instead of 30+ objects.
B
53
S
16
G
6
Posts: 718
Reputation: 9,150

Post » Sat Aug 16, 2014 9:26 pm

Bl4ckSh33p wrote:Is there no way to let invisible layers act like there were not there? (all objects not registering/blocking clicks)?
I used some invisble layers for UI menus because its easier to just show/hide a layer instead of 30+ objects.


I don't think so. In my case I finally gave up and used a different layout for my menus. After all this is not what layers are for. Still, if you HAVE to use layers for this kind of thing it is a pain in the butt. What I suggest is using control instance variables, like registering clicks only if "isClickable" is true.
B
16
S
7
G
1
Posts: 154
Reputation: 3,117

Post » Sun Aug 17, 2014 7:46 am

This is one way:
You do not have the required permissions to view the files attached to this post.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 17, 2014 8:28 am

Here's another way.
Opening a menu while keeping the game visible:
You do not have the required permissions to view the files attached to this post.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests