Phaser home
Phaser AE
Open source
Phaser 4
Download
Learn
Editor
Tools
Docs
Examples
News
Log in
Examples
/
Input
/
Dragging
Phaser 4.1.0
Phaser 4 examples
Dragging
22
examples
Examples
22
Basic Sprite Dragging
Demonstrates how to make a sprite draggable by setting the interactive draggable property and updating its position during the drag event.
Bring Dragged Item to Top
Learn how to use the Display List bringToTop method to move a Game Object to the front of the scene when a drag operation begins.
Camera Movement and Object Dragging
Demonstrates dragging interactive objects while navigating a large world using camera keyboard controls, featuring parallax effects and automatic group rotation.
Drag Distance Threshold
Demonstrates how to use the dragDistanceThreshold property to require the pointer to move a minimum number of pixels before an object starts being dragged.
Drag Horizontally
Demonstrates how to restrict sprite movement to the horizontal axis and apply boundary constraints using the drag event and Phaser.Math.Clamp.
Drag on a Fixed Axis
Demonstrates how to lock a sprite's movement to either the horizontal or vertical axis based on the direction of the initial drag gesture.
Drag Time Threshold
Demonstrates how to set a time delay in milliseconds that must pass before an object is considered being dragged.
Drag Vertically
Demonstrates how to restrict sprite movement to the vertical axis during a drag operation and clamp the movement within a specific coordinate range.
Drag With Multiple Scenes
Demonstrates how to handle interactive objects and drag events across multiple simultaneously active scenes.
Dragging a Container
Demonstrates how to make a Container interactive and draggable. Shows that a Container must have a defined size to receive input and move all its child objects together.
Dragging Rotated and Scaled Objects
Demonstrates how to drag a Game Object that has been rotated and scaled, showing that hit detection remains accurate despite the transformations.
Dragging with Scroll Factor
Demonstrates how to drag Game Objects that have different scroll factor values. The input system automatically accounts for the scroll factor, ensuring the object tracks the pointer correctly even when configured for parallax movement.
Multi Camera Stack of Cards
Demonstrates dragging interactive objects across multiple viewports, each with different zoom levels and rotations.
Multiple Draggables
Demonstrates how to drag multiple overlapping Game Objects simultaneously by setting the input topOnly property to false.
Multiple Rotated and Scaled Draggable Objects
Demonstrates dragging multiple Game Objects that have been randomly scaled and rotated. It includes bringing the active object to the top of the display list upon dragging.
Multiple Scene Drag
Learn how to implement independent drag-and-drop interactions for game objects across multiple concurrently active scenes.
Retain Index After Drag
Demonstrates how to temporarily bring a Game Object to the top of the display list during a drag event and restore its original depth index once released.
Scale During Drag
Demonstrates how to dynamically adjust the scale of a Game Object based on its vertical position while it is being dragged across the screen.
Scrolling Text Box
Demonstrates how to create a scrollable text area using a Geometry Mask and pointer velocity to drag text within a specific zone.
Simple Sprite Dragging
Demonstrates how to make a sprite interactive, enable it for dragging, and use the drag event to update its position as the pointer moves.
Snap To Grid On Drag
Demonstrates how to use Phaser.Math.Snap.To to align game objects to a fixed 64x64 grid while dragging.
Stack of Cards
Learn how to make multiple images draggable and use the dragstart event to bring the active object to the top of the display list.