Getting started with multi touch in phaser with the pointers array.
1 - What to know
1.1 - This is a phaser ce 2.x post
In this post I am using phaser ce 2.11.1 of phaser.
2 - Quickly getting started with the pointers array
One way to quickly know what is going on with the current status of the pointers array is by using the pointer debug method.
3 - Using game.input.addPointer to increase the length of the pointers array
By default there are only two pointer objects in the pointers array, if You want to make a project that makes use of more pointers you will want to use the addPointer method to do so.
4 - Max Pointers
As of this writing I am using phaser 2.8.8, and the max amount of pointers allow appears to be 10. I can not see a need for there to be more than that, so I would say that is an adequate ceiling for it.
5 - Comparison with pointer1, pointer2, pointer3, ect
There are a number of properties in the game.input object that contain references to the latest pointer object for a certain touch in multi touch. That is if just one finger is on the screen then what is going on with it can be found at game.input.pointer1, if there are two fingers, and you want to do something involving that data, then game.input.pointer2 is of interest.
This is basically just a different way of accessing the same data in that game.input.pointer1 is the same thing as game.input.pointers.
So both options are provided, which you use depends on your coding style.
6 - Multi touch example
So for full working quick example of the use of the pointers array in phaser I thought I would put together something where the position of a display object is effected by the number of active pointers there are.
Whats nice about the pointers array is that it there to begin with when it comes to doing anything that involves looping over all pointer objects. Keep in mind that if you do not use the active property to weed out any inactive pointers, then values from the latest objects will be used.
7 - Conclusion
So the pointers array is one of two options in game.input to use when it comes to doing something involving multi touch.