ID:166581
 
How would I make an object that you can click and hold in the mouse button to make it move to where you release the button?
obj/MouseDropTest
MouseDrop(atom/over_object)
walk_towards(src,over_object)

Those are the basics of how you'd do it.
In response to Ephraim
What I wanted was for it to warp it there instantly in case there are dense things in the way, but that's easy to fix.

But where would I add an "if(src.clickwarp == 1)" so that you can only move the object at certain times, or so that only certain people can do it?
In response to Cowdude
obj/MouseDrop(overobj,srcloc,overloc)
if(clickwarp)
loc = overloc


As a suggestion, you may want to move the object to a null location while you are dragging it, so someone else doesn't try to move it and wonder why it isn't working.

I have a very nice drag and drop inventory system in my tactical shooter I'm working on, and I move things to a null loc while dragging them, since they basically become the cursor while being dragged.

Hope that helps
In response to Ephraim
Actually, I think he'd want to use usr.clickwarp, because src would be the object itself.
In response to DerDragon
I meant I wanted a place to check if the person dragging the object is allowed to move things. That check stops the object from being draggable.
In response to Cowdude
Ah, well why didn't you say so?


mob
var/clickwarp
admin
clickwarp = 1
obj/MouseDrop(overobj,srcloc,overloc)
if(usr.clickwarp)
loc = overloc
In response to DerDragon
I think I did say so, but oh well :P
And it turns out that the other person made the reply about the "usr.clickwarp" as I was making my other post so I didn't see it :(
Hi all, I am digging this out to ask a similar question: Is it possible in byond to have objects exist on the screen but associated by pixels rather than the grid? In other words, is it possible (and is there a lib) to drag and drop an object literally wherever you want?

Thanks a lot.