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

#1 2010-07-11 12:39:05

Gveradux
Scratcher
Registered: 2010-06-18
Posts: 100+

Need dragging script!

SO I made a dragging script, but my sprite wont keep up with my mouse! can someone help?

Offline

 

#2 2010-07-11 12:40:20

MaxtheWeirdo
Scratcher
Registered: 2010-03-18
Posts: 500+

Re: Need dragging script!

Click the lock on the sprite. It will make the sprite draggabble.


My website. Hall Crawler My Awesome OS
It's just marketing, guys! Nothing sinister!

Offline

 

#3 2010-07-11 12:56:43

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Need dragging script!

MaxtheWeirdo wrote:

Click the lock on the sprite. It will make the sprite draggabble.

To add onto this, the lock is above the Scripts pane, where it shows all the information on the sprite such as the name and direction.

Or, if you need to sprite to only be draggable at certain times, you can use this script:

Code:

When Green flag clicked
forever
  if < <touching mouse pointer> and <mouse down> >
    repeat until <not <mouse down> >
      go to mouse-pointer
    end repeat
  end if
end forever

Offline

 

#4 2010-07-11 13:16:06

ihaveamac
Scratcher
Registered: 2007-09-22
Posts: 1000+

Re: Need dragging script!

Adding to coolstuff's post, this is his code in block form:
http://i30.tinypic.com/243419g.gif

Plus, coolstuff, you made a bbcode typo in http://scratch.mit.edu/forums/viewtopic.php?id=40174.

Last edited by ihaveamac (2010-07-11 13:17:21)


~ihaveamac - visit ihaveamac.net

Offline

 

#5 2010-07-11 13:23:41

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

Re: Need dragging script!

coolstuff wrote:

Or, if you need to sprite to only be draggable at certain times, you can use this script:

http://i30.tinypic.com/243419g.gif

"Go to mouse pointer" makes the sprite align it's center with the mouse - Since you won't click the center of the sprite, it will 'jump.' If you don't want the sprite to do that, you can do this:

http://i31.tinypic.com/51zwgl.gif

Last edited by Harakou (2010-07-11 13:27:52)


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

Offline

 

#6 2010-07-11 13:55:23

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Need dragging script!

Thanks everyone for adding onto my script! And thanks ihaveamac for finding my BBCode mistake  big_smile

Offline

 

Board footer