how to select object based on UID in expression

Get help using Construct 2

Post » Fri Oct 25, 2013 11:51 pm

hi,

I have three white boxes which contain an instance variable called "Slot". This variable contain the slot number which is actually a UID number of another sprite.

there are 4 different duplicate sprite instances with unique UID and they represent the slot for white boxes. The problem is white boxes has to be adjusted after moving towards their slots...all white boxes moves to the slots but all adjusted their self to wrong slots...

I am using set angler toward slot(Sprite.slot).X and slot(Sprite.slot).Y

where slot is the sprite name, Sprite is the white box and Sprite.slot contain the unique UID for the slot.

For detail please check my project file

https://dl.dropboxusercontent.com/u/104183650/testmyfile.capx
B
9
S
2
Posts: 108
Reputation: 1,010

Post » Sat Oct 26, 2013 12:10 am

set val default value to 0 instead of 14. You select by IID with sprite(x), not UID
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Sat Oct 26, 2013 10:59 am

Thanks a lot , changing my logic from uid to IID worked fine. But why they dont display IID like UID through property sheet i had to display their numbers on run time to use it.
B
9
S
2
Posts: 108
Reputation: 1,010

Post » Sat Oct 26, 2013 11:28 am

Because IID's are just indexes of objects. Manual explains it better. :)

I'd recommend you use UID's and use the 'pick by uid' condition instead of referring to IID's in expressions. Referring to things in expressions is coderish way of doing things and not necessary in C2 :)
B
24
S
9
G
7
Posts: 756
Reputation: 7,302

Post » Sat Oct 26, 2013 2:44 pm

I am new to construct2 can you show me any example because previously i was using unique id but i was unable to select the object in expression. My logic was simple that each white box contain a unique id of bottom yellow boxes where they get adjust...
B
9
S
2
Posts: 108
Reputation: 1,010

Post » Sat Oct 26, 2013 3:17 pm

Here is what I was talking about: https://dl.dropboxusercontent.com/u/19921470/testmyfile.capx
B
24
S
9
G
7
Posts: 756
Reputation: 7,302

Post » Sat Oct 26, 2013 3:39 pm

Just one thing, if you're wanting to stop them clicking to slots that don't match, you might need to check again the UID/Slot # on the overlap test :

Image
B
27
S
9
G
5
Posts: 488
Reputation: 11,948

Post » Sat Oct 26, 2013 3:44 pm

Thanks everyone for contributing your experiences , i really appreciate that.
B
9
S
2
Posts: 108
Reputation: 1,010


Return to How do I....?

Who is online

Users browsing this forum: Magistross, mihirolover, tarek2 and 8 guests