For Each Family Instance...

Get help using Construct 2

Post » Thu Apr 18, 2013 7:55 pm

On start-up of my layout, I need to step through each instance of a sprite found in a family so I can set their positions/scale. I see the "For Each" and "For" loops, but I can't figure out how to affect each instance. I'm sure there's a way... Anybody know how?

Pseudo code would be like:

Local Int:h = LayoutHeight
Local Int:c = 0
Local Int:pad = 20
For Each bttn in My_Buttons
bttn.Y = SetY( h/My_Buttons.count * c + pad)
c += 1
Next

Thank you!
cklester2013-04-18 19:58:58
B
21
S
5
Posts: 43
Reputation: 2,529

Post » Thu Apr 18, 2013 8:29 pm

I just posted a ForEach example on another thread. Should be sufficient for this thread too.

FunctionForEach.capx
ImageImageImage
B
67
S
19
G
123
Posts: 3,210
Reputation: 73,907

Post » Thu Apr 18, 2013 8:45 pm

Can I provide my capx so you can see what I want to do? I don't think a simple For Each is going to cut it (but I don't know enough to know for sure, and your code didn't deal with a Family as far as I could tell).
cklester2013-04-18 20:47:28
B
21
S
5
Posts: 43
Reputation: 2,529


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, abdalghani, Ethan, Marxally, Naightwolf and 21 guests