I made an event so when the cursor touch is on an object it modifies a text.
i have multiple layers that have multiple objects that modify the same text object but the problem is if a layer is hidden it still reacts to the Cursor/touch object and modifies the text.
Any idea how can i disable the cursor touch event on a hidden layer?
There should be condition to check if layer is hidden (or maybe it was if layer is visible)
You could use that in event where you allow for text to change and set it so that if it is hidden it changes to something
As said, you can check if the layer that the object is on is visible. Something like
I am using something like this
but it is not working
Never use Of all of these conditions are true if it is not inside if one of these conditions is true
For example it it should be used like on screenshot below
In your 1st condition you add trigger once in condition and now you need to add action to change text
Next your 2nd event should not be sub event so move it to the left and add trigger once to condition while in action add change text and put in text field this “”
Which will make it display nothing
Thing is when you change text of object it does not revert back to anything if you do not set up it that way
Like imagine you have idle animation and walk animation on player
It won’t switch from idle to walk and then back to idle if you stop walking
Unless you set up to change animation to walk when player is moving
AND change animation to idle when player is not moving
Maybe Im confused. Why is layer is visible event inverted?
Is mouse over object
If layer of object is visible
The 1st condition picks the object, the 2nd condition checks if the layer that it’s on is visible and triggers any actions or sub events.
You explained it so well lol it was great thank you so much, but i am still stuck on one problem (THE CURSOR/TOUCH IS AN OBJECT) is still showing the names of object from the previous layers (the layer that is hidden)
It is for if the layer is not visible
The sprite is same but with different part of animation with different item names
i am using this event at the moment
The problem that persist is that the (CURSOR/TOUCH) is still reading the object from the layers that are hidden
how do i solve that?
Looking at your screenshot from post where you reply to Keith
1 - you are using if one of these conditions is true
Well then if layer is not visible or if cursor or touch is on inventoryindicator
Then it will display text from 1st action
2 - in 2nd condition you have if cursor or touch is NOT on inventoryindicator
But if layer inventory crop is not visible then it will still display text from 1st event action
You should have one event where ONLY conditions you have are
- REMOVE if one of these is true
- cursor is on inventoryindicator
- inventory crop is visible (or not visible if that is what you need)
And 2nd event condition then should be perfectly fine to remove text
Unless I misunderstood your need. Something like this is all you need.
You can add trigger once and then a list of conditions to clear the text but by then all of the extra conditions are going to use more process time then they save by preventing 1 action.
Simple is good.
When i removed the if one of these conditions is true then it stopped working but i did the event as Keith said and it is working. Thank you for your help
Yes it is working just as i wanted thank you very much but a new problem has appeared and that is that some of the animation’s name is getting captured by the cursor touch but some of them don’t, even though they are on visible layer and their collision box is big enough.
Can you post how you’re using the events. Maybe a little before and a little after? Just for context. How about a screenshot or description of the scene in action so we can get a little more idea of what you are making.
Okay so the event below is for opening and closing inventory.
And the inventory buttons event just switches back and forth between layers.
So if you click button 1 it hides all the other layers 2,3,4, etc then if you click button 2 it hides layer 1,3,4 etc
all those different layers have the object/sprite (Inventory Indicator) with different animations and names and there is one single text object on each layer which shows the names of the animations upon touch
and then below that is the event you told me
I hope that explains what i am doing.
You’re right. There’s something wrong with my logic. Let me do a little more testing. BRB
I made 3 layers Layer1 Layer2 Layer3
I set up these events
And now when you click on tree it will display text of which layer is currently visible but only if cursor is on tree
If you move cursor away from tree text will disappear
But if you move it back on tree it will show current layer text
Click on tree
OK, I think I understand what’s happening, although I’m not sure I agree with it. There’s something with the layer is visible. I don’t think it works with instances without being in a for each object I’m not saying it’s broken, it’s just how it works.
My solution is to set the active layer to a string like activeLayer when you press an inventory button and compare it to the sprites layer.
This is my test project:
The code for my test project. I assigned an id variable from 1 to 3 for the objects. It’s just quicker for me to do in testing. I might not actually use that but it’s quick and easy for testing.
ok, you already have a global variable. you can use it to check the layer.
if cursor over objectName
if objectName is on layer “Layer” + ToString(GlobalVariable(Lay))
But it won’t modify the text if i go to different object on visible layer.