Drag and Drop an Actor with the Mouse [Answered]


  • Posts: 13
Hi Stencylers,

How would I go about dragging and dropping an actor with the mouse in-game?  I want the player to be able to grab an actor while they are holding down the mouse button and drop the actor wherever it is released.  Thanks!

EDIT: I figured out how to attach the actor to the mouse while clicking, but it only attaches the top-left corner and, as such, I can only move the actor diagonally to the bottom-right.  If I try to move up or left while still clicking, the actor detaches itself from the cursor.  Help?

« Last Edit: March 06, 2012, 11:48:21 pm by Jon »


  • *
  • Posts: 17529
In 2.0, we've written up a definitive drag and drop behavior that we're pre-shipping with the software. If you're using 2.0, it should be located under the "Controls" category.

You can preview the behavior here.

If you're trying to do this with touch, the following may be useful.


  • Posts: 13
Great! That's perfect! :)

Thanks for the quick response!


  • Posts: 48
Is there a way to do this AND still have the actor's collisions happen (as per it's collision group)?

edit : ignore that.... it DOEs to that. I had the actor set to "cannot be pushed", and it behaves very differently then.

i.e. with that set to cannot be pushed, it is possible to drop one actor on-top of aother and no collision be registered  :)

« Last Edit: April 15, 2012, 02:52:36 am by sparkyidr »