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
5
G
5
Posts: 9
Reputation: 3,662

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
386
S
229
G
87
Posts: 24,201
Reputation: 191,530

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: 774
Reputation: 6,650

Post » Thu Jan 19, 2012 6:37 pm

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


Return to How do I....?

Who is online

Users browsing this forum: BackendFreak, Kitsune42k, Lukioks and 1 guest