Construct 2 is being retired on 1 Jul, 2021. We strongly recommend upgrading to Construct 3.
Drag & Drop
The Drag & Drop behavior enables objects to be dragged and dropped either by mouse or touch. On multi-touch devices, multiple objects can be dragged and dropped at once.
An object starts dragging when a mouse click or touch falls inside the object's collision polygon. It is released when the mouse button is released or the touch ends.
Drag & Drop properties
- Optionally axis-limit the movement, for example only allowing the object to be dragged horizontally or vertically. The default is Both, allowing the object to be dragged anywhere.
- Initial state
- Whether the behavior is initially enabled or disabled. If disabled, it can be enabled at runtime using the Set enabled action. #Drag & Drop conditions#
- Is dragging
- True if the object is currently being dragged by mouse or touch.
- Is enabled
- True if the behavior is currently enabled; false if disabled by the Set enabled action.
- On drag start
- Triggered when the object is clicked or touched inside its collision polygon.
- On drop
- Triggered when the object is being dragged, and the mouse button is released or the touch ends.
Drag & Drop actions
- Set enabled
- Enable or disable the Drag & Drop behavior. If disabled, clicking or touching the object has no effect and the object cannot be dragged. It also becomes 'transparent' to clicks and touches, meaning other objects underneath it can still be dragged and dropped. If the object is being dragged when it is disabled, the drag is cancelled, but On drop will not trigger.
- Stop dragging the object if it is currently being dragged. This also triggers On drop.
Drag & Drop expressions
The Drag & Drop behavior has no expressions.
Construct 2 Manual
You are here:
Search this manual:
This manual entry was last updated on 9 Jun, 2020 at 12:45