Inverted For

Get help using Construct 2

Post » Tue May 28, 2013 1:02 pm

Greetings there.


I am trying to make a mouse scrolling based weapon changing between some "activated" weapons in an array.

I've managed to get it working on the down scroll that actually increments the index and i can to some stuff and select the appropriate weapon.

But for the up scrolling, i need to go upwards, i need a for loop with a negative increment, and it seems that it doesn't work with the default for.

Can someone confirm that? Or give me a workaround or something :S


Thanks in advance
B
1
Posts: 1
Reputation: 127

Post » Tue May 28, 2013 2:35 pm

You'll have to use a local variable for that, or do the inversion yourself everytime you use the loopindex. If your "step" is -1, I'd use the second method.

For x = 0 to upperBound
---Set variable to upperBound - loopindex
B
69
S
28
G
24
Posts: 977
Reputation: 18,739


Return to How do I....?

Who is online

Users browsing this forum: unicornspitfire and 32 guests