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
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
I have a family with a numeric instance variable.
I'd like to get the max value of this variable from all family items.
Is there a way to do that?
local variable: maxValue=0
for each family instance
-set maxValue to max(maxValue,family.instanceVariable)
something like this.
You mean that on layout start I should loop through all family instance and use the max function?
That would work I guess (I'll give it a try asap)
SO no function like Max but that would deal with families instance variable right away?
Thx for the quick answer
Develop games in your browser. Powerful, performant & highly capable.
Another way to do this is to use For Each (ordered), descending, and use Stop loop to stop at the first value.
blackhornet Does stop loop not just skips the current loop ?
Actually I make every time:
locale var break = 0
+ for each ordered by...
+ break = 0
'Stop loop' stops the 'For each' from progressing, so if you do it immediately, you stop on the first one, which with 'descending', will be the highest value.
thanks good to know
You could use max(Sprite.xz,Sprite2.xz,Sprite3.xz)
But obviously you have to list each object.
Or you could use the "Pick instance with highest/ lowest instance variable" condition.
Ok I'll test that as well.
Good to have several ways to do it.