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.
<img src="http://files.getdropbox.com/u/1024727/images/selection%20thing.PNG">
+ For each object
+ Object is in selected area
-> add .x to global('avX')
-> add .y to global('avY')
-> add 1 to global('numSelected')
+ Always
-> Set redcrossthing.x to (avX / numSelected)
-> Set redcrossthing.y to (avY / numSelected)
Develop games in your browser. Powerful, performant & highly capable.
whoa, thats a great simple idea. thanks!
If I'm not mistaken
Cubic(sprite1.x,sprite2.x,sprite3.x,sprite4.x,0.5)[/code:24m40yrr] [code:24m40yrr]Cubic(sprite1.y,sprite2.y,sprite3.y,sprite4.y,0.5)[/code:24m40yrr] 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