Phaser home
Phaser AE
Open source
Phaser 4
Download
Learn
Editor
Tools
Docs
Examples
News
Log in
Examples
/
Input
/
Game Object
Phaser 4.1.0
Phaser 4 examples
Game Object
19
examples
Examples
19
Custom Shape Hit Area
Demonstrates how to define a custom interactive hit area for a Game Object using a geometric shape and a manual hit-test callback function.
Custom Sprite Hit Area Size
Demonstrates how to adjust a Sprite's input hit area to be smaller, larger, or offset compared to its texture size using the hitArea.setTo method.
Debug Hitareas
Learn how to visualize and debug interactive hit areas using different geometric shapes like Polygons, Circles, Ellipses, Rectangles, and Triangles.
Destroy Sprite on Click
Learn how to remove interactive Game Objects from the scene by calling the destroy method within a global 'gameobjectdown' input event listener.
Game Object Pointer Move Event
Demonstrates how to listen for the pointermove event on a specific interactive Game Object, updating its color tint as the pointer moves across it.
Input Overlap with Top-Only Disabled
Demonstrates how to trigger input events for every overlapping Game Object under the pointer, rather than just the top-most one, by setting input.setTopOnly to false.
Interactive Graphics Object
This example demonstrates how to make a Graphics object interactive by assigning a geometric hit area and responding to pointer events.
Interactive Hand Cursor
Demonstrates how to change the mouse cursor to a 'pointer' (hand icon) when hovering over an interactive Game Object.
Multiple Game Object Up
Demonstrates how to use the gameobjectup event to handle pointer release actions on multiple interactive Game Objects.
Multiple Object Input Events
Demonstrates how to handle pointer down and up events across a large grid of interactive GameObjects using scene-level input listeners.
Multiple Pointer Over and Out Events
Demonstrates how to use scene-level input events to detect when the pointer enters or leaves any interactive Game Object, applying a tint effect to highlight the target.
Pointer Over and Out Events
Demonstrates how to use the pointerover and pointerout events to detect when a mouse pointer enters or leaves a Game Object's hit area.
Pointer Up Event
Handle the pointerup event on an interactive Game Object to trigger an action when the pointer is released.
Select and Deselect Sprites
Manage object selection state by toggling texture frames on click and using event propagation to deselect items when clicking the background.
Sprite Pointer Events
Demonstrates how to listen for pointer down and up events on an interactive Game Object to trigger actions like changing a sprite's tint.
Sprite Pointer Events
Demonstrates how to change a sprite's texture frame when the mouse pointer enters and leaves its interactive area.
TileSprite Input Interaction
Demonstrates how to make a TileSprite interactive and handle pointer events, such as changing its tint and position when clicked.
Top Only Over and Out Events
Demonstrates how to toggle the topOnly input property to control whether hover events fire only for the topmost object or for all overlapping Game Objects.
World Space Input Interaction
Demonstrates interacting with Game Objects in world space while the camera is rotated, zoomed, and translated, including converting screen-space pointer coordinates into camera-relative world coordinates.