Phaser API Documentation

  Version: 
pointWithinInteractiveObject(object, x, y)

Description:

Checks if the given x and y coordinate are within the hit area of the Interactive Object.

This method assumes that the coordinate values have already been translated into the space of the Interactive Object.

If the coordinates are within the hit area they are set into the Interactive Objects Input localX and localY properties.

Parameters:

name type description
object Phaser.Types.Input.InteractiveObject

The Interactive Object to check against.

x number

The translated x coordinate for the hit test.

y number

The translated y coordinate for the hit test.

Returns:
Description:

true if the coordinates were inside the Game Objects hit area, otherwise false.

Type:
  • boolean
Since: 3.0.0