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
Game development stories & opinions
Is it possible to get an average X,Y coordinate from a group of objects?
Say I've used the selection box to select those blue boxes, I'm not sure how I'd get the coordinates of that red thing.
+ For each object
+ Object is in selected area
-> add .x to global('avX')
-> add .y to global('avY')
-> add 1 to global('numSelected')
-> Set redcrossthing.x to (avX / numSelected)
-> Set redcrossthing.y to (avY / numSelected)
whoa, thats a great simple idea. thanks!
Develop games in your browser. Powerful, performant & highly capable.
If I'm not mistaken
Should get the average, or half the distance between all.
Cubic is not an average, it's an interpolator.
Deadeye's code would do the trick