Getting a center point in an array of points with Phaser ce
In todays post on Phaser ce I will be covering the Point.centroid method than can be used to quickly get the arithmetic average of an array of Phaser.Point instances in the form on a single Phaser.Point instance. This might come of use in certain projects where such a point is of interest.
1 - What to know before continuing
1.1 - This is a phaser ce 2.x post
In this post I am using phaser community edition 2.11.1 of phaser
2 - Basic example of Point.centroid
A basic example of Point.centroid would just be something like this then.
I just created an array of two points, and then used the Phaser.Point.centroid static method to get the average of those two points.
3 - Conclusion
This is an interesting method, of course it would not be to hard to make my own method to do it from the ground up, but it is nice to know that many methods like this are in the Point class that can be used to help me save time from writing a solution over each time.