Finding sprites in code

Get help using Construct 2

Post » Thu Jan 19, 2012 1:48 pm

My problem is that I have multiple sprites of the same type and I want to access them from the event sheet. For example I have a 'wall' sprite 4 times in one layer and I want to change the coordinates of the second instance of the wall. Is this possible and how can I do this? Thanks!
B
9
S
4
G
5
Posts: 9
Reputation: 3,582

Post » Thu Jan 19, 2012 2:54 pm

See how events work - events fundamentally work by picking individual instances.

In this case you might want to pick it based on an instance variable, or maybe use the system condition 'Pick Nth'.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Jan 19, 2012 3:28 pm

There are many ways how to do that. Besides Ashley's tip, you can try example which comes with C2. When you start C2, on the welcome screen click "Browse all examples" and open "Unique IDs (UIDs).capx" file. You can find more details about it in the manual and also in this topic.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Thu Jan 19, 2012 6:37 pm

Thanks guys! It seems I should study the manual more :D
B
9
S
4
G
5
Posts: 9
Reputation: 3,582


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests