Sets the hit area for the given array of Game Objects.
A hit area is typically one of the geometric shapes Phaser provides, such as a Phaser.Geom.Rectangle
or Phaser.Geom.Circle
. However, it can be any object as long as it works with the provided callback.
If no hit area is provided a Rectangle is created based on the size of the Game Object, if possible to calculate.
The hit area callback is the function that takes an x
and y
coordinate and returns a boolean if
those values fall within the area of the shape or not. All of the Phaser geometry objects provide this,
such as Phaser.Geom.Rectangle.Contains
.
name | type | arguments | description |
---|---|---|---|
gameObjects | Phaser.GameObjects.GameObject | Array.<Phaser.GameObjects.GameObject> |
An array of Game Objects to set the hit area on. |
|
hitArea | any | Phaser.Types.Input.InputConfiguration | <optional> |
Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. |
hitAreaCallback | Phaser.Types.Input.HitAreaCallback | <optional> |
The 'contains' function to invoke to check if the pointer is within the hit area. |
This InputPlugin object.