Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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) ?
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.
Develop games in your browser. Powerful, performant & highly capable.
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.
For convenience, I guess. Like using the "set position" action, instead of "set X" and "set Y"
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? :)
You guys, I just used:
For "" from 10 to 1
-> Text: append Loopindex
and it totally works.