How do I refer to object names

Get help using Construct 2

Post » Wed Jul 16, 2014 8:58 am

i have 100 sprites, all named spr00, spr01, spr02 ... spr99 all with opacity 0

i want to achieve something like this:

spr_number = random(100)

spr&spr_number = opacity(100)

i don't want to set up 100 lines with conditional IFs on every sprite

Is this possible in C2?

thanks a lot
B
43
S
11
G
4
Posts: 428
Reputation: 7,454

Post » Wed Jul 16, 2014 9:18 am

you could try the nickname plugin
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Wed Jul 16, 2014 9:27 am

so it cannot be done with C2 without extra plugins?
B
43
S
11
G
4
Posts: 428
Reputation: 7,454

Post » Wed Jul 16, 2014 9:44 am

Have all the sprites in a single family. Use the condition "System: Pick random instance" of the family. Set the opacity of the instance to 100.
That's about what your pseudo code is supposed to do, right ?
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,317
Reputation: 87,483

Post » Wed Jul 16, 2014 9:50 am

I think this will work for you..

http ://i .imgur.com /Z swYmOR.jpg
Though i have not tried.instead of object batter you just need to put your object name .
Remove space in between
B
3
Posts: 2
Reputation: 179

Post » Wed Jul 16, 2014 12:09 pm

the animation trick is an interesting concept.
however having all sprites as 1 animation won't work in my case

thanks
B
43
S
11
G
4
Posts: 428
Reputation: 7,454

Post » Wed Jul 16, 2014 12:09 pm

@Kyatric yes i want to generate a random number and set the sprite with that number name, opacity to 100
B
43
S
11
G
4
Posts: 428
Reputation: 7,454

Post » Wed Jul 16, 2014 12:18 pm

@Kyatric thanks the Family system worked perfectly!
B
43
S
11
G
4
Posts: 428
Reputation: 7,454


Return to How do I....?

Who is online

Users browsing this forum: mrkaio, Zav and 1 guest