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
Our educational partners
Free education resources to use in the classroom
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
How would I implement a For each... -style condition in my object? SVN does not have examples on this, such as Array::For each element.
Is it just a matter of (pseudoish code):
long ExtObject::cForEachThing(LPVAL params)
if(things.size() == 0)
return false; //no things, no for each
//reset counter if at end
if(currentThing == things.end());
currentThing = things.begin();
and then an expression to retrieve data from currentThing. Doesn't this just get called once per frame, when I want to go through each object on every frame?
You would have to loop through everything in that thing.
so you would have a loop
for(int i =0; i < keys.length; i++)
currentKey = keys[i]
in your expression ace
somthing like that I think would be how its done
gotta go to bed, so I don't have time to distill the answer down, but here's a good start (especially ashley's part)
Lucid did you forget to post something along with that?
Develop games in your browser. Powerful, performant & highly capable.
oh yeah, oops:
Interesting, I wouldn't have ever figured that out on my own.
Yeah, Lucid's link has the right way to do it. You have to hijack the event system to repeat the event actions multiple times - if you don't do that the actions will only ever be run once!