Phaser API Documentation

  Version: 
getCharacterAt(x, y, [camera])

Description:

Gets the character located at the given x/y coordinate within this Bitmap Text.

The coordinates you pass in are translated into the local space of the Bitmap Text, however, it is up to you to first translate the input coordinates to world space.

If you wish to use this in combination with an input event, be sure to pass in Pointer.worldX and worldY so they are in world space.

In some cases, based on kerning, characters can overlap. When this happens, the first character in the word is returned.

Note that this does not work for DynamicBitmapText if you have changed the character positions during render. It will only scan characters in their un-translated state.

Parameters:

name type arguments description
x number

The x position to check.

y number

The y position to check.

camera Phaser.Cameras.Scene2D.Camera <optional>

The Camera which is being tested against. If not given will use the Scene default camera.

Returns:
Description:

The character object at the given position, or null.