Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
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.