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

#1 2008-02-07 15:57:32

pross67
Scratcher
Registered: 2007-05-26
Posts: 18

dropping sprites onto other sprites

How do you get a sprite to recognize another sprite has been dropped on top of it, not just touching it? For example, on a game board where you have draggable pieces, and you dragged a piece onto something and left it there, instead of just brushing over it.

I've tried using the timer in conjunction with the touching block, but with no results.

Thanks.

Offline

 

#2 2008-02-07 16:31:32

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

Re: dropping sprites onto other sprites

Try
[blocks]
<if><<<touching[ SPRITE    <and>   <not>  <mouse down?>>>
<end>
[/blocks]

Last edited by Mayhem (2008-02-07 16:34:07)


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-02-07 16:53:43

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: dropping sprites onto other sprites

You mean a prite that "fits" onto another sprite while you are dragging?

Try this:

If ( (abs (x position)) - (abs (xposition of sprite1) ) < 5 and ( (abs (y position)) - (abs (yposition of sprite1) ) < 5
   go to sprite1


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#4 2008-02-07 17:03:22

pross67
Scratcher
Registered: 2007-05-26
Posts: 18

Re: dropping sprites onto other sprites

Thanks to both your responses.

The "not mouse down" one works best for me (and my 6th graders).
I'll try the other option some other time.

Thanks again!

Offline

 

#5 2008-02-07 17:14:09

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

Re: dropping sprites onto other sprites

Of course, my solution assumes that you need to hold the mouse down to move the piece.


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

 

Board footer