This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-26 12:04:42

Awesome79
New Scratcher
Registered: 2012-03-18
Posts: 2

How do you make a drag and drop script?

I want to make a game where you can pick up and object and drop it somewhere else so how do i do it?

Offline

 

#2 2012-03-26 12:07:22

Splodgey
Scratcher
Registered: 2011-04-26
Posts: 500+

Re: How do you make a drag and drop script?

If you want it to be always draggable, click the lock-pad thing next to the sprite name. If you want it sometimes, draggable, just ask and I'll give you the scripts.

Offline

 

#3 2012-03-26 12:11:20

Awesome79
New Scratcher
Registered: 2012-03-18
Posts: 2

Re: How do you make a drag and drop script?

Ok thank you very much  smile

Offline

 

#4 2012-03-31 09:33:35

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: How do you make a drag and drop script?

I have another way:

when gf clicked
set [draggable? v] to [false]
forever if <(mouse down?) and (touching [mouse-pointer v] ? )>
if <(draggable?) = [false]>
set [draggable? v] to [true]
repeat until <not (mouse down?)>
go to [mouse-pointer v]
end
set [draggable? v] to [false]
end
Feel free to ask more questions.  tongue


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#5 2012-04-01 05:25:50

Splodgey
Scratcher
Registered: 2011-04-26
Posts: 500+

Re: How do you make a drag and drop script?

jontmy00 wrote:

I have another way:

when gf clicked
set [draggable? v] to [false]
forever if <(mouse down?) and (touching [mouse-pointer v] ? )>
if <(draggable?) = [false]>
set [draggable? v] to [true]
repeat until <not (mouse down?)>
go to [mouse-pointer v]
end
set [draggable? v] to [false]
end
Feel free to ask more questions.  tongue

Add "Relative X" and y to make it slightly better.

Offline

 

Board footer