The Point Class in phaser ce
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 Phaser.Point
To create an instance of Phaser.Point I just need to call the constructor with the new keyword, and pass the x and y values for the point. Once that is done I can use methods such as Point.angle which will give me the angle to another given point.
In addition to prototype methods there are also static methods that can be used as well without having to create point instances first.
2 - Getting the angle between two points
So a very common task when working with points is to find the distance between two points. So of course for this there is the Point.angle method. This method can be used as a prototype method off an instance of Phaser.Point or as a stand alone static method like with this example here.
3 - Getting the distance between two points
Another common task with Points is finding the distance between two of theme. With phaser there is no need to retype or copy and past the same old distance formula each time I start a new project the Point.distance method is always there at the ready.
There is also a distance formula in Phasers math object as well.
4 - Rotating one point around another
I wrote a post on this using Point.rotate but I will also cover it beirfly here as well.
5 - Conclusion
So working with Points in phaser is a fairly easy and straight forward process once you become aware of how to go about using the class to help make quick work of common programming tasks with Points.
As I write more posts and update older content on phaser I will update this post with more examples, and links to additional content on working with Points in phaser ce. If you feel as though something is missing, mentioning it in the comments will help expedite the process of expanding this content. I have a lot of content on phaser, and posts that get the most traction do take higher priority when it comes to revision.