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

#1 2008-11-30 12:39:20

big-bang
Scratcher
Registered: 2008-02-21
Posts: 1000+

Script Sharing

Share some of your most useful scripts! You could help somebody out!

In case you want to drag and drop sprites onscreen, here is the script:
<when[ Whatever ]clicked>
<repeat until><<  <not> <mouse down?> >>
<go to x sad  <mouse x> )y sad  <mouse y>
<end>
Note: It is drag and drop, so you will have to keep holding the mouse.


http://i47.tinypic.com/6edrbm.jpghttp://i45.tinypic.com/dw9hmw.jpghttp://i50.tinypic.com/f28tvn.jpghttp://i45.tinypic.com/ruwaop.jpg

Offline

 

#2 2008-11-30 12:48:46

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Script Sharing

The only problem with that code is that if you have more than one object that can be dragged and dropped, they can all stick to the mouse at the same time.

The best way around this is to use a variable "dragging" which is set to 1 when you are dragging something.  Objects to be dragged should then be set to only be dragged if "dragging" = 0.

*****

Alternatively, just use the little padlock symbol in the sprite title block, to set it as draggable  wink

Last edited by Mayhem (2008-11-30 12:49:28)


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#3 2008-11-30 13:02:57

big-bang
Scratcher
Registered: 2008-02-21
Posts: 1000+

Re: Script Sharing

I never noticed that!!!


http://i47.tinypic.com/6edrbm.jpghttp://i45.tinypic.com/dw9hmw.jpghttp://i50.tinypic.com/f28tvn.jpghttp://i45.tinypic.com/ruwaop.jpg

Offline

 

#4 2008-12-02 18:10:32

big-bang
Scratcher
Registered: 2008-02-21
Posts: 1000+

Re: Script Sharing

One disadvantage though: you can't open or close the lock at will on the Internet.


http://i47.tinypic.com/6edrbm.jpghttp://i45.tinypic.com/dw9hmw.jpghttp://i50.tinypic.com/f28tvn.jpghttp://i45.tinypic.com/ruwaop.jpg

Offline

 

#5 2008-12-10 20:21:23

MrMadMan
Scratcher
Registered: 2008-10-28
Posts: 100+

Re: Script Sharing

<when green flag clicked>
<forever>
<next costume>


http://scratch.mit.edu/forums/viewtopic.php?id=18385
Go to build a life  big_smile  Offical Member of Hero RPG

Offline

 

Board footer