Hi
Is there a way to use conditions in for loops, like:
<font face="Courier New, Courier, mono">for (int ytemp = y; ytemp > (y-ylen); ytemp--)</font>
Or at least a way to have the loop count backwards, like from 10 to 1 (instead of form 1 to 10) ?
Did you try changing the 'for' and 'to' parameters? If it works in Javascript, it (should) work in C2.
sqiddster I just tried
For "loop" from 100 to 0: append text "loopindex"
And it doesn't work. If I change it to "from 0 to 100" it works, meaning for loops don't count down, which it should
7Soul ,I think it's because it's an inclusivee loop , you may need a variable counting from 100 to 0 to get that count down ...
I'm pretty sure I read somewhere that for loops in C2 don't count backwards, can't seem to find where though.
Oh, that's interesting.
I don't really see why you'd need it though. If you use a variable containing the end value for the loop, you can just do "variable-loopindex" and it'll start on the variable value and count backwards to 0.
Nimtrix
For convenience, I guess. Like using the "set position" action, instead of "set X" and "set Y"
7Soul:
Yes, of course. I just meant if there are issues with backwards loops, it's not really a big deal since it's an easy workaround. But it would of course be more convenient to have the option.
Ashley - Can you clear this up for us, please? :)
Develop games in your browser. Powerful, performant & highly capable.
You guys, I just used:
For "" from 10 to 1
-> Text: append Loopindex
and it totally works.