Pick correct instance ID

Get help using Construct 2

Post » Tue Mar 19, 2013 3:47 pm

Hello,
I'm in trouble again.
I've read all FAQs about IDs.

I have 4 instances of a Sprite.
I need to determine what instance has been picked and make an action on this.

CAPX

For example, when I click one of the 4 instance, it changes the animation frame from 0 to 1.

Can you help me, please?ghale2013-03-19 15:47:48
B
10
S
4
G
4
Posts: 42
Reputation: 3,091

Post » Tue Mar 19, 2013 4:13 pm

You can simply add 'Set animation frame to 1' action there. It will work, because triggers(conditions with little green arrows) like touch generally apply to some specific instance(s) of the object, in this case the one you are touching. So you don't need to pick objects in any more specific way in this case :)vee412013-03-19 16:14:35
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Tue Mar 19, 2013 4:48 pm

@vee41
Thanks for your reply.

I need to get the ID because I have to do other actions according to the item that has been choose (ex: compare the item picked with a variable)
B
10
S
4
G
4
Posts: 42
Reputation: 3,091

Post » Tue Mar 19, 2013 5:06 pm

Since the touched object is the currently picked object, you can use "Object.UID" to get it's UID as an expression. Just plug it into whatever you need.

System: Compare Two Values MyVariable = Object.UID

For example.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Tue Mar 19, 2013 5:16 pm

@theubie

YES!!!

Thank you very much, solved!
B
10
S
4
G
4
Posts: 42
Reputation: 3,091


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 19 guests