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

#1 2010-08-07 09:31:07

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Script for Draggable Sprite

Hi, I found out a good and efficient way to make a draggable sprite. Here is the script:

http://i34.tinypic.com/20j1us4.jpg
If the image above won't show up, click here.

Last edited by HD123 (2010-08-07 13:21:17)


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&online=http://lemonfanatic.webs.com/ONLINE.png&offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

#2 2010-08-07 09:44:24

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Script for Draggable Sprite

Nice! It works very well  smile


http://i.imgur.com/WBkM2QQ.png

Offline

 

#3 2010-08-07 09:54:39

JeanTheFox
Scratcher
Registered: 2010-06-14
Posts: 1000+

Re: Script for Draggable Sprite

I don't want to burst your bubble or anything but if you click the little lock icon next to the sprite;
http://i35.tinypic.com/209fz83.png
Then your sprite can be move online and in presentation mode  smile


http://i51.tinypic.com/20gcn5j.png

Offline

 

#4 2010-08-07 12:31:25

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Script for Draggable Sprite

This seems like too much scripting for not enough return. Most of the script really isn't necessary, and there are better dragging algorithms anyway, like this one, which doesn't cause that annoying snap to pointer when you start dragging.

http://i33.tinypic.com/5ogx9l.gif

Sorry.  sad


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#5 2010-08-07 13:09:21

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: Script for Draggable Sprite

JeanTheFox wrote:

I don't want to burst your bubble or anything but if you click the little lock icon next to the sprite;
http://i35.tinypic.com/209fz83.png
Then your sprite can be move online and in presentation mode  smile

I already knew about that for a long time, I just felt like scripting it.  big_smile


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&online=http://lemonfanatic.webs.com/ONLINE.png&offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

#6 2010-08-07 13:10:55

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: Script for Draggable Sprite

Thanks for looking at this, I will try and improve it now.

Update:
Improved! Now it works exactly like the little button next to the sprite name.

Last edited by HD123 (2010-08-07 13:25:24)


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&online=http://lemonfanatic.webs.com/ONLINE.png&offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

#7 2010-08-07 13:24:27

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: Script for Draggable Sprite

Harakou wrote:

This seems like too much scripting for not enough return. Most of the script really isn't necessary, and there are better dragging algorithms anyway, like this one, which doesn't cause that annoying snap to pointer when you start dragging.

http://i33.tinypic.com/5ogx9l.gif

Sorry.  sad

You can say what you want about my dragging scripts. That's your opinion

Last edited by HD123 (2010-08-07 13:30:40)


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&online=http://lemonfanatic.webs.com/ONLINE.png&offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

#8 2010-08-07 14:24:32

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Script for Draggable Sprite

i personally find both methods equally valuable  smile

it's a good alternative to the lock button especially if you want it to follow the mouse only at a certain condition!

way better than the more common 'override' method where you have an extra script which overrides the lock button in holding the sprite's position. (which by the way only works in presentation mode)

well done!

Offline

 

#9 2010-08-07 20:57:42

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: Script for Draggable Sprite

bump


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&online=http://lemonfanatic.webs.com/ONLINE.png&offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

#10 2010-08-09 08:00:46

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: Script for Draggable Sprite

BumPity


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&online=http://lemonfanatic.webs.com/ONLINE.png&offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

#11 2010-08-09 08:14:34

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Offline

 

#12 2010-08-09 16:41:47

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Script for Draggable Sprite

HD123 wrote:

Harakou wrote:

This seems like too much scripting for not enough return. Most of the script really isn't necessary, and there are better dragging algorithms anyway, like this one, which doesn't cause that annoying snap to pointer when you start dragging.

http://i33.tinypic.com/5ogx9l.gif

Sorry.  sad

You can say what you want about my dragging scripts. That's your opinion

Hey, don't take offense. I was just trying to be helpful.  sad


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#13 2010-08-10 06:49:59

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: Script for Draggable Sprite

Harakou wrote:

HD123 wrote:

Harakou wrote:

This seems like too much scripting for not enough return. Most of the script really isn't necessary, and there are better dragging algorithms anyway, like this one, which doesn't cause that annoying snap to pointer when you start dragging.

http://i33.tinypic.com/5ogx9l.gif

Sorry.  sad

You can say what you want about my dragging scripts. That's your opinion

Hey, don't take offense. I was just trying to be helpful.  sad

Oh. OOPS!  big_smile  No offense taken.


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&online=http://lemonfanatic.webs.com/ONLINE.png&offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

#14 2010-08-10 08:57:44

chipguy
Scratcher
Registered: 2009-09-09
Posts: 500+

Re: Script for Draggable Sprite

you can just do if mouse down and touching sprite whatever, repeat until mouse up, go to mouse pointer.


2 times easier. to me.


http://scratch.mit.edu/static/projects/chipguy/2919121_sm.png by yours truly  big_smile

Offline

 

#15 2010-08-10 14:37:39

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Script for Draggable Sprite

chipguy wrote:

you can just do if mouse down and touching sprite whatever, repeat until mouse up, go to mouse pointer.


2 times easier. to me.

True, but the point of his script was to make it exactly like the "Make sprite drag able" button, except only during specific conditions.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

Board footer