How do I make this menu work?

Get help using Construct 2

Post » Wed Jul 18, 2012 8:46 pm

I have this menu made of several instances of the same text object. The menu is made up of different layers, and each layer is a separate view of the menu (the different layers are set to visible/invisible when navigating).

The text object has an instance variable GoToLayer containing the number of the layout to go.

When clicking a text object, it checks if the text object's layer is visible, and if so it sets the new layer visible.
The event sheet looks like this:


Everything works well if the text instances are not placed on top of each other in the different layers!
But the menu doesn't work when the text instances overlap each other, probably because the second condition fails for the instance of the invisible text..?

So what is the easiest way to make this work (using events)?

I've included a CAPX here. You can test to run the example as is, and then try moving one of the texts so that they don't overlap.

Maybe there's a bug in the trigger, when several triggers are triggered?basti2012-07-19 18:09:35
B
20
S
5
G
4
Posts: 51
Reputation: 4,139

Post » Wed Jul 18, 2012 9:59 pm

@Ashley: could this be a bug ?
Apparently, when text objects are overlapping and that the first instance is invisible, it seems like only this instance is tested.
That's kind of unexpected, as I think that with sprites, even overlapping, all would work as expected (the visible instance would trigger/execute the code).
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Wed Jul 18, 2012 10:18 pm

In my personal experience, I've only been able to make the text disappear off of the top layer if I request that it itself goes invisible as its own command. I've been using Chrome and Firefox mostly, not sure if there was some sort of incompatibility, but my workaround of telling it to disappear manually has worked for me in similar instances thusfar.
B
6
Posts: 8
Reputation: 716

Post » Thu Jul 19, 2012 6:28 am

@Kyatric: it's not only text objects, it's the same unexpected behavior for sprites as well.basti2012-07-19 06:28:46
B
20
S
5
G
4
Posts: 51
Reputation: 4,139

Post » Thu Jul 19, 2012 5:05 pm

my question for @Ashley Does making a layer invisible make each object on that layer invisible? As in if I test if an object on an invisible layer is visible will it be false?

If yes to that then Id say this is a bug. It shouldnt be triggering on the invisible ones. If its no then you need to not just turn a layer off but also test to see if that layer is visible when the texted are touched to trigger the right events

I do know that invisible objects on a layer can still be touched cause Ive had to work with that mself
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Thu Jul 19, 2012 6:15 pm

Yeah you can click on/interact with objects that are invisible. When you click on the overlapping text you're clicking both of them and this line:
System: Layer Text.LayerNumber is visible
Which Text object is that referring to? Because you don't specify and you have two picked, it uses the first one every time.

menuLayersClicking.capx (r99)
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000

Post » Thu Jul 19, 2012 6:19 pm

@aridale: Making the layer invisible does not automatically make the object property 'Visible' to false (it was made like this in a previous release, if I remember correctly). And I think it should also be this way, since you can check whether the layer is visible using 'Layer Object.LayerNumber is visible'.

EDIT:
@ramones: Thank you for the clarification, I understand the problem now :) So this is not a bug, it's just how it works when you have several picked objects from the trigger event.basti2012-07-19 18:31:01
B
20
S
5
G
4
Posts: 51
Reputation: 4,139


Return to How do I....?

Who is online

Users browsing this forum: currypuff, makotto, randomly, Walessio and 28 guests