This asset package allows you to turn your object(s) into an object with drag-and-drop capabilities, with a minimal amount of work for you.
Comes with a working demo (import all assets)
Drag and drop an object with 1 call
Drop an object so it snaps to another object's location (with optional range check)
Must read the included READ_ME.txt file before using scripts
There are two primary scripts that allow you to quickly add drag-and-drop functionality with a single call:
scr_dragNdrop(objToMove, dragDepth, mouseDragIcon); scr_dragNdrop_ext(objToMove, dragDepth, mouseDragIcon, snap_obj, snap_x, snap_y, maxDistX, maxDistY);
However, there are also seven scripts to help you customize drag-and-drop functionality for your project:
scr_dNd_drag(objToDrag, dragDepth, mouseDragIcon); scr_dNd_drop(objToDrop); scr_dNd_getDist(value_1, value_2); scr_dNd_getManager(); scr_dNd_snap(objToMove, snap_obj, snap_x, snap_y, maxDistX, maxDistY); scr_dNd_snapBack(objToDrop); scr_dNd_snapTo(objToDrop, pos_x, pos_y);
Each script contains comments explaining what the script does, and how it works.
Documentation is also included as a plain text file named "dragNdrop_doc.txt."
Please read all included text files, starting with "READ_ME.txt," they will explain how to setup and use the dragNdrop scripts properly.
You may NOT:
If you have any questions, do not hesitate to ask them, I will be more than happy to answer.
You can reach me through the dragNdrop scripts forum (click the "Support" link above); or you can email me at:
RossSolutions_Games@yahoo.com (click the "Contact Publisher" link above).
2 new variables must now be added to your drag-and-drop enabled objects: - isSingleDrop - isLocked
Updated the scripts: - scr_dNd_drop [lines 46-51] - scr_dNd_snapTo [lines 59-64]
It is now possible to set an object(s) to lock in place after it has been moved once via the dragNdrop scripts. For objects using the advanced drag and drop script "scr_dragNdrop_ext()" and snaps to a specific object, the object being dragged will only be locked after successfully snapping to the snap object.
Please refer to the included text file "Using_dragNdrop.txt" for details on updating your objects with the necessary code to use this new feature.
Version 1.0.4. Published September 3, 2016
Created with GameMaker: Studio v1.4.1567
This asset hasn't received enough reviews yet.
You can only review assets you've bought.
Thank you, useful scripts, saved time!
Just one thing - in the demo project, the snap function does not work very well, see the video on the link: