[SOLVED]How do I sequentially add to an instance variable?

Get help using Construct 2

Post » Fri Feb 17, 2017 11:34 pm

Hi. I swear I've gotten something like this to work in the past but I have no idea how I did it. I might not even be remembering correctly, no clue.

Anyway, I have a simple sprite with an instance variable on it called index, it set to 0 by default. All I want to do is create say, 3 instances of that object in-game but with the index variable for each of them to sequentially increase by 1.

So the first instance it's index would be 1
The second instance it's index would be 2
The third instance it's index would be 3 and so on and so on.

I feel like this should be very simple to do but I'm not quite sure how to make it happen.

Can anyone offer any insight on it?

Thanks :)
Last edited by Kazan on Sat Feb 18, 2017 12:05 am, edited 1 time in total.
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Fri Feb 17, 2017 11:44 pm

You use 'for' 1 to n, then create object with instance variable as 'loopindex'
B
46
S
16
G
77
Posts: 2,159
Reputation: 45,833

Post » Sat Feb 18, 2017 12:04 am

Thank you sooo much! :)
B
19
S
7
G
10
Posts: 82
Reputation: 4,996


Return to How do I....?

Who is online

Users browsing this forum: AllanR, brunopalermo, ST314, TheRealDannyyy, tunepunk and 24 guests