How do I pick multiples instances of same object ?

Get help using Construct 2

Post » Fri Oct 02, 2015 9:31 am

Hello

I would like to know how to pick multiples instances of the same object for using it in the same action

For example :

- I click on a sprite, I save the UID in a variable
- I click on an other instance of the same sprite
How can I check the distance between the two instances of the same sprite ?
The "distance" function is easy to use but with two different object...

Thanks
B
13
S
4
G
4
Posts: 72
Reputation: 3,505

Post » Fri Oct 02, 2015 10:22 am

easiest, would be to have the object in an extra family. ie object player in family "Checker"

tmpUID = 0


on click player
sub event: tmpUID = 0 ?
-action: set tmpUID = player.UID
else
pick all checker
pick checker by evaluate checker.uid = tmpUID
-action: set text to: distance(player.X,player.Y,checker.X,checker.Y)
-action: set tmpUID 0
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Fri Oct 02, 2015 12:56 pm

Nice trick ! Thanks !
B
13
S
4
G
4
Posts: 72
Reputation: 3,505


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests