Looping through private variables of an object

For questions about using Classic.

Post » Tue Mar 08, 2011 10:47 pm

Is there any way in Construct to loop through all private variables of a particular sprite?
Must I name these private variables in a special way? What actions do I use?
Thanks.
B
5
S
1
G
3
Posts: 59
Reputation: 993

Post » Tue Mar 08, 2011 11:08 pm

What is it you are trying to do chap?
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Tue Mar 08, 2011 11:45 pm

if you want to set or alter each variable:

loop from 0 to the number of variables you have
when setting a variable or adding/subtracting from it, right click where you select the name of the variable and click "use expression", and type 'loopindex' (without the quotes)

I can't think of a way off the top of my head to use the values
like
sprite(loopindex) or anything like that won't work
maybe with python there's a way
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed Mar 09, 2011 12:50 am

Might be better to put the sprite in a container with something like an array, and then store your variables in the array.
Image Image
B
161
S
48
G
90
Posts: 7,350
Reputation: 66,755


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests