Interface: GameObjectEventsMap

Phaser.Types.GameObjects. GameObjectEventsMap

Methods


destroy(gameObject)

The Game Object Destroy Event.

This event is dispatched when a Game Object instance is being destroyed.

Listen for it on a Game Object instance using GameObject.on('destroy', listener).

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object which is being destroyed.

Since: 3.0.0
Source: src/gameobjects/events/DESTROY_EVENT.js (Line 21)

drag(pointer, dragX, dragY)

The Game Object Drag Event.

This event is dispatched by an interactive Game Object if a pointer moves while dragging it.

Listen to this event from a Game Object using: gameObject.on('drag', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive and enabled for drag. See GameObject.setInteractive for more details.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

dragX number

The x coordinate where the Pointer is currently dragging the Game Object, in world space.

dragY number

The y coordinate where the Pointer is currently dragging the Game Object, in world space.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_DRAG_EVENT.js (Line 27)

dragend(pointer, dragX, dragY)

The Game Object Drag End Event.

This event is dispatched by an interactive Game Object if a pointer stops dragging it.

Listen to this event from a Game Object using: gameObject.on('dragend', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive and enabled for drag. See GameObject.setInteractive for more details.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

dragX number

The x coordinate where the Pointer stopped dragging the Game Object, in world space.

dragY number

The y coordinate where the Pointer stopped dragging the Game Object, in world space.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_DRAG_END_EVENT.js (Line 27)

dragenter(pointer, target)

The Game Object Drag Enter Event.

This event is dispatched by an interactive Game Object if a pointer drags it into a drag target.

Listen to this event from a Game Object using: gameObject.on('dragenter', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive and enabled for drag. See GameObject.setInteractive for more details.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

target Phaser.GameObjects.GameObject

The drag target that this pointer has moved into.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_DRAG_ENTER_EVENT.js (Line 26)

dragleave(pointer, target)

The Game Object Drag Leave Event.

This event is dispatched by an interactive Game Object if a pointer drags it out of a drag target.

Listen to this event from a Game Object using: gameObject.on('dragleave', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive and enabled for drag. See GameObject.setInteractive for more details.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

target Phaser.GameObjects.GameObject

The drag target that this pointer has left.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_DRAG_LEAVE_EVENT.js (Line 26)

dragover(pointer, target)

The Game Object Drag Over Event.

This event is dispatched by an interactive Game Object if a pointer drags it over a drag target.

When the Game Object first enters the drag target it will emit a dragenter event. If it then moves while within the drag target, it will emit this event instead.

Listen to this event from a Game Object using: gameObject.on('dragover', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive and enabled for drag. See GameObject.setInteractive for more details.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

target Phaser.GameObjects.GameObject

The drag target that this pointer has moved over.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_DRAG_OVER_EVENT.js (Line 29)

dragstart(pointer, dragX, dragY)

The Game Object Drag Start Event.

This event is dispatched by an interactive Game Object if a pointer starts to drag it.

Listen to this event from a Game Object using: gameObject.on('dragstart', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive and enabled for drag. See GameObject.setInteractive for more details.

There are lots of useful drag related properties that are set within the Game Object when dragging occurs. For example, gameObject.input.dragStartX, dragStartY and so on.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

dragX number

The x coordinate where the Pointer is currently dragging the Game Object, in world space.

dragY number

The y coordinate where the Pointer is currently dragging the Game Object, in world space.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_DRAG_START_EVENT.js (Line 30)

drop(pointer, target)

The Game Object Drop Event.

This event is dispatched by an interactive Game Object if a pointer drops it on a Drag Target.

Listen to this event from a Game Object using: gameObject.on('drop', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive and enabled for drag. See GameObject.setInteractive for more details.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

target Phaser.GameObjects.GameObject

The Drag Target the gameObject has been dropped on.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_DROP_EVENT.js (Line 26)

pointerdown(pointer, localX, localY, event)

The Game Object Pointer Down Event.

This event is dispatched by an interactive Game Object if a pointer is pressed down on it.

Listen to this event from a Game Object using: gameObject.on('pointerdown', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive. See GameObject.setInteractive for more details.

The event hierarchy is as follows:

  1. GAMEOBJECT_POINTER_DOWN
  2. GAMEOBJECT_DOWN
  3. POINTER_DOWN or POINTER_DOWN_OUTSIDE

With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop the propagation of this event.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

localX number

The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.

localY number

The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.

event Phaser.Types.Input.EventData

The Phaser input event. You can call stopPropagation() to halt it from going any further in the event flow.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_POINTER_DOWN_EVENT.js (Line 37)

pointermove(pointer, localX, localY, event)

The Game Object Pointer Move Event.

This event is dispatched by an interactive Game Object if a pointer is moved while over it.

Listen to this event from a Game Object using: gameObject.on('pointermove', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive. See GameObject.setInteractive for more details.

The event hierarchy is as follows:

  1. GAMEOBJECT_POINTER_MOVE
  2. GAMEOBJECT_MOVE
  3. POINTER_MOVE

With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop the propagation of this event.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

localX number

The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.

localY number

The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.

event Phaser.Types.Input.EventData

The Phaser input event. You can call stopPropagation() to halt it from going any further in the event flow.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_POINTER_MOVE_EVENT.js (Line 37)

pointerout(pointer, event)

The Game Object Pointer Out Event.

This event is dispatched by an interactive Game Object if a pointer moves out of it.

Listen to this event from a Game Object using: gameObject.on('pointerout', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive. See GameObject.setInteractive for more details.

The event hierarchy is as follows:

  1. GAMEOBJECT_POINTER_OUT
  2. GAMEOBJECT_OUT
  3. POINTER_OUT

With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop the propagation of this event.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

event Phaser.Types.Input.EventData

The Phaser input event. You can call stopPropagation() to halt it from going any further in the event flow.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_POINTER_OUT_EVENT.js (Line 35)

pointerover(pointer, localX, localY, event)

The Game Object Pointer Over Event.

This event is dispatched by an interactive Game Object if a pointer moves over it.

Listen to this event from a Game Object using: gameObject.on('pointerover', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive. See GameObject.setInteractive for more details.

The event hierarchy is as follows:

  1. GAMEOBJECT_POINTER_OVER
  2. GAMEOBJECT_OVER
  3. POINTER_OVER

With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop the propagation of this event.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

localX number

The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.

localY number

The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.

event Phaser.Types.Input.EventData

The Phaser input event. You can call stopPropagation() to halt it from going any further in the event flow.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_POINTER_OVER_EVENT.js (Line 37)

pointerup(pointer, localX, localY, event)

The Game Object Pointer Up Event.

This event is dispatched by an interactive Game Object if a pointer is released while over it.

Listen to this event from a Game Object using: gameObject.on('pointerup', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive. See GameObject.setInteractive for more details.

The event hierarchy is as follows:

  1. GAMEOBJECT_POINTER_UP
  2. GAMEOBJECT_UP
  3. POINTER_UP or POINTER_UP_OUTSIDE

With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop the propagation of this event.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

localX number

The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.

localY number

The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position.

event Phaser.Types.Input.EventData

The Phaser input event. You can call stopPropagation() to halt it from going any further in the event flow.

Since: 3.0.0
Source: src/input/events/GAMEOBJECT_POINTER_UP_EVENT.js (Line 37)

wheel(pointer, deltaX, deltaY, deltaZ, event)

The Game Object Pointer Wheel Event.

This event is dispatched by an interactive Game Object if a pointer has its wheel moved while over it.

Listen to this event from a Game Object using: gameObject.on('wheel', listener). Note that the scope of the listener is automatically set to be the Game Object instance itself.

To receive this event, the Game Object must have been set as interactive. See GameObject.setInteractive for more details.

The event hierarchy is as follows:

  1. GAMEOBJECT_POINTER_WHEEL
  2. GAMEOBJECT_WHEEL
  3. POINTER_WHEEL

With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop the propagation of this event.

Parameters:
Name Type Description
pointer Phaser.Input.Pointer

The Pointer responsible for triggering this event.

deltaX number

The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device.

deltaY number

The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device. This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down.

deltaZ number

The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device.

event Phaser.Types.Input.EventData

The Phaser input event. You can call stopPropagation() to halt it from going any further in the event flow.

Since: 3.18.0
Source: src/input/events/GAMEOBJECT_POINTER_WHEEL_EVENT.js (Line 38)