Object is not invisible when on invisible layer?

Get help using Construct 2

Post » Wed Dec 05, 2012 1:30 pm

Is this correct? If I make a layer invisible, and then do a count of visible objects which are on that layer, it still reports that all of the objects are visible, even though they're not. Does the fact that they're on an invisible layer not set them as invisible?
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Wed Dec 05, 2012 2:49 pm

Making the layer invisible used to make the 'Is visible' object condition return false, but some users disagreed and said they needed separate control. So the 'Is visible' condition only returns the object's own visibility flag, which is still visible even if on an invisible layer, and even if offscreen. If you also want to test the layer's visibility, just add a 'Is layer visible' condition as well.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed Dec 05, 2012 3:51 pm

I can see the wisdom of that approach, I can see times when the extra control would be useful, and you can never have too much control :)

On the other hand, a simple command to combine everything might be useful if it was possible, something like a 'Is showing' which combines everything to determine if the object is actually showing at that time.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Wed Dec 05, 2012 4:17 pm

I'm having a really strange problem with this which I can't resolve.

I have 3 layers, each with a tile on it, which I want to be clickable with the mouse. They're all in the same place but I only want the one on the currently visible layer to be clickable. The tiles are in a family but I don't think that matters here.

So the solution would seem to be....

Mouse - On left button clicked on 'tiles'
System - tiles.Layername is visible

I would have thought this would filter so that only the tile which is on the visibile layer would be picked. But it doesn't work when there are 3 tiles ontop of each other, and only one layer is visible (it picks none). If I move one of the tiles so that it's not in the same location at the others on the invisible layers, it does pick that one tile when visible and clicked).

Just to add to that, if I remove the second condition (check if the layer is visible), it does then correctly pick all 3 tiles. So the first condition is working correctly, it does pick the 3 tiles that have been clicked, but something's wrong with the way it filters the next condition.farflamex2012-12-05 16:29:14
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Wed Dec 05, 2012 7:12 pm

[QUOTE=farflamex]
Mouse - On left button clicked on 'tiles'
System - tiles.Layername is visible
[/QUOTE]
It's probably just checking the visibility of the first layer. Try a 'for each tiles' in between those two conditions.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Wed Dec 05, 2012 7:34 pm

Yep, that worked, thanks. Still finding it a bit confusing when I need to use a 'For each', since I'd filtered the objects correctly and thought the subsequent conditions applied to each of the filtered objects anyway. Still, it works.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633


Return to How do I....?

Who is online

Users browsing this forum: armaldio, ETgirl79, TiagoCesar and 19 guests