Clickable objects and their Z order

Just started using Construct 2? Post your questions here

Post » Fri Feb 10, 2017 4:02 pm

Hi! Thanks in advance to help me and sorry for my english: it isn't my mother tongue...
I'm wondering if the "Z order", or the "layer order", affect the clickable objects.
For example, I have a "Y sprite" on top of layer and cover an "X sprite" in another below layer. Why if I click of the "Y sprite", also the action pair of "X sprite" is running? I tried with another condition like "If Y is visible", etc, but doesn't work...
Some tips?
Thanks very much!!
B
5
Posts: 17
Reputation: 264

Post » Fri Feb 10, 2017 4:06 pm

You can pick an object in events by which is on the top or bottom of the z order, if that's what you're trying to do.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,991

Post » Fri Feb 10, 2017 4:18 pm

Thanks. The problem is when I run the preview of layout, therefore is a problem of Event/Action. In the Layout view I can pick the different object.
B
5
Posts: 17
Reputation: 264

Post » Fri Feb 10, 2017 5:55 pm

If you post your capx someone can probably explain to you more easily.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,991

Post » Mon Feb 13, 2017 9:29 am

Here is the capx:
https://drive.google.com/open?id=0B_Dxi ... mc0MnRsV1E
If I "tap on" the green button, nothing happens.
If I disable the event number 3 in the event sheet, the green button works.
Why?! :)
B
5
Posts: 17
Reputation: 264

Post » Mon Feb 13, 2017 10:18 am

Event 2 always sets Event 3 true.

Its is not so that the 'on tap' in event 2 steals the 'on tap' in event 3.

They are triggers. Triggers fire when that event, what they are designed to catch, happens.
Every condition that starts with 'on' is a trigger.

So if you have a thousandth 'on tap gesture', they all trigger when the 'tap' happens. And since you make event 3 always true (by setting the layer visible in event 2, and by having a fullscreen button), event 3 will trigger always when event 2 triggers.

Tinkering about a solid solution for you.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Feb 13, 2017 10:29 am

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Feb 13, 2017 11:11 am

99Instances2Go wrote:This what you look for ?

https://www.dropbox.com/s/9uhqpeq5ubod6 ... .capx?dl=0


Thanks, it's working perfectly!!! :D I'm also understanding the trigger system (more or less!).
Judging from your capx, it seems rather easy. ..I hope I'll be able to continue by myself!
Thank you very much!
B
5
Posts: 17
Reputation: 264

Post » Mon Feb 13, 2017 11:28 am

Besides the 'triggers', use 'else' to keep events from making the next event true.

A simple example:

If a = 1
___do this
___set a to 2

If a = 2
___do that
___set a to 3

If a = 3
___do something else
___set a to 1

Do you see that the first event 'a=1' sets the second event always true ?
Use "else" to avoid this. So ....

If a = 1
___do this
___set a to 2

else
If a = 2
___do that
___set a to 3

else
If a = 3
___do something else
___set a to 1
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Feb 13, 2017 12:15 pm

Your explanation should be integrated in the Manual. :) Thank you for the massive help!
B
5
Posts: 17
Reputation: 264


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests