Class: Pointer

Phaser. Pointer

A Pointer object is used by the Mouse, Touch and MSPoint managers and represents a single finger on the touch screen.

new Pointer(game, id)

Phaser - Pointer constructor.

Parameters:
Name Type Description
game Phaser.Game

A reference to the currently running game.

id Description

Description.

Source:

Members

active

Description.

Properties:
Name Type Description
isDown boolean

Description.

Default Value:
  • false
Source:

circle

A Circle object centered on the x/y screen coordinates of the Pointer. Default size of 44px (Apple's recommended "finger tip" size).

Properties:
Name Type Description
circle Circle
Default Value:
  • null
Source:

circle

Description

Properties:
Name Type Description
circle Phaser.Circle
Source:

clientX

The horizontal coordinate of point relative to the viewport in pixels, excluding any scroll offset.

Properties:
Name Type Description
clientX number
Source:

clientY

The vertical coordinate of point relative to the viewport in pixels, excluding any scroll offset.

Properties:
Name Type Description
clientY number
Source:

<readonly> duration

How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.

Properties:
Name Type Description
duration number

How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.

Source:

game

Properties:
Name Type Description
game Phaser.Game

Local reference to game.

Source:

id

Properties:
Name Type Description
id Description

Description.

Source:

isDown

If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true.

Properties:
Name Type Description
isDown boolean
Default Value:
  • false
Source:

isMouse :boolean

If the Pointer is a mouse this is true, otherwise false.

Type:
  • boolean
Properties:
Name Type Description
isMouse boolean
Source:

isUp

If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true.

Properties:
Name Type Description
isUp boolean
Default Value:
  • true
Source:

msSinceLastClick

The number of miliseconds since the last click.

Properties:
Name Type Description
msSinceLastClick number
Source:

pageX

The horizontal coordinate of point relative to the viewport in pixels, including any scroll offset.

Properties:
Name Type Description
pageX number
Source:

pageY

The vertical coordinate of point relative to the viewport in pixels, including any scroll offset.

Properties:
Name Type Description
pageY number
Source:

position

A Vector object containing the current position of the Pointer on the screen.

Properties:
Name Type Description
position Vec2
Default Value:
  • null
Source:

position

Description

Properties:
Name Type Description
position Phaser.Point
Source:

positionDown

A Vector object containing the initial position when the Pointer was engaged with the screen.

Properties:
Name Type Description
positionDown Vec2
Default Value:
  • null
Source:

positionDown

Description

Properties:
Name Type Description
positionDown Phaser.Point
Source:

previousTapTime

A timestamp representing when the Pointer was last tapped or clicked.

Properties:
Name Type Description
previousTapTime number
Default Value:
  • 0
Source:

screenX

The horizontal coordinate of point relative to the screen in pixels.

Properties:
Name Type Description
screenX number
Source:

screenY

The vertical coordinate of point relative to the screen in pixels.

Properties:
Name Type Description
screenY number
Source:

targetObject

The Game Object this Pointer is currently over / touching / dragging.

Properties:
Name Type Description
targetObject Any
Default Value:
  • null
Source:

timeDown

A timestamp representing when the Pointer first touched the touchscreen.

Properties:
Name Type Description
timeDown number
Default Value:
  • 0
Source:

timeUp

A timestamp representing when the Pointer left the touchscreen.

Properties:
Name Type Description
timeUp number
Default Value:
  • 0
Source:

totalTouches

The total number of times this Pointer has been touched to the touchscreen.

Properties:
Name Type Description
totalTouches number
Default Value:
  • 0
Source:

withinGame

Description.

Properties:
Name Type Description
withinGame boolean
Source:

<readonly> worldX

Gets the X value of this Pointer in world coordinates based on the world camera.

Properties:
Name Type Description
duration number

The X value of this Pointer in world coordinates based on the world camera.

Source:

<readonly> worldY

Gets the Y value of this Pointer in world coordinates based on the world camera.

Properties:
Name Type Description
duration number

The Y value of this Pointer in world coordinates based on the world camera.

Source:

x

The horizontal coordinate of point relative to the game element. This value is automatically scaled based on game size.

Properties:
Name Type Description
x number
Source:

y

The vertical coordinate of point relative to the game element. This value is automatically scaled based on game size.

Properties:
Name Type Description
y number
Source:

Methods

justPressed(duration) → {boolean}

The Pointer is considered justPressed if the time it was pressed onto the touchscreen or clicked is less than justPressedRate.

Parameters:
Name Type Argument Description
duration number <optional>
Source:
Returns:
Type
boolean

justReleased(duration) → {boolean}

The Pointer is considered justReleased if the time it left the touchscreen is less than justReleasedRate.

Parameters:
Name Type Argument Description
duration number <optional>
Source:
Returns:
Type
boolean

leave(event)

Called when the Pointer leaves the target area.

Parameters:
Name Type Description
event Any
Source:

move(event)

Called when the Pointer is moved

Parameters:
Name Type Description
event Any
Source:

reset()

Resets the Pointer properties. Called by InputManager.reset when you perform a State change.

Source:

start(event)

Called when the Pointer is pressed onto the touchscreen.

Parameters:
Name Type Description
event Any
Source:

stop(event)

Called when the Pointer leaves the touchscreen.

Parameters:
Name Type Description
event Any
Source:

toString() → {string}

Returns a string representation of this object.

Source:
Returns:

A string representation of the instance.

Type
string

update()

Description.

Source:
Phaser Copyright © 2012-2013 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Thu Nov 07 2013 06:07:39 GMT-0000 (GMT) using the DocStrap template.