Set a global variable as an object

Get help using Construct 2

Post » Wed Nov 09, 2011 7:47 pm

For an example, I have 100 sprites(S1,S2,S3... S100), and a global number "n". The "n" could be a random number from 1 to 100. Is there a way to set a position as S"n".X, S"n".Y in Construct 2? Any suggestions would be greatly appreciated!oriskao2011-11-09 20:14:16
B
6
G
2
Posts: 11
Reputation: 1,214

Post » Wed Nov 09, 2011 8:10 pm

not sure if it will work like that but this maybe helps

system 'for each sprite' and then system expression 'loopindex'

loopindex gives you the number of current loop

so you could say in the for each loop , set position Sprite.x * loopindex and sprite.y * loopindex so sprite 1 will be x0 y0 sprite2 x10 y10 sprite3 x20 y20

ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Wed Nov 09, 2011 10:24 pm

[QUOTE=vtrix] not sure if it will work like that but this maybe helps

system 'for each sprite' and then system expression 'loopindex'

loopindex gives you the number of current loop

so you could say in the for each loop , set position Sprite.x * loopindex and sprite.y * loopindex so sprite 1 will be x0 y0 sprite2 x10 y10 sprite3 x20 y20

[/QUOTE]

Thank you for the idea! but what I hope to find out more is the way to represent a variable with combination of a global variable and text.
B
6
G
2
Posts: 11
Reputation: 1,214


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, Axiomaltd, OddConfection and 20 guests