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:
<img src="https://dl.dropbox.com/s/4vbj6rjhvymks1x/menuexample.png" border="0">
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?
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).
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.
Kyatric: it's not only text objects, it's the same unexpected behavior for sprites as well.
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
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.
Develop games in your browser. Powerful, performant & highly capable.
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'.
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.