Discuss Scratch

scratchFST
Scratcher
11 posts

Mouse Click

I know how to do it, but I have a project where you drag things.When you touch something else when you are press another thing, it follows your mouse too. Is there any way that I can fix it? Thanks!

scubajerry
Scratcher
1000+ posts

Mouse Click

Yes - share your project.
scratchFST
Scratcher
11 posts

Mouse Click

scubajerry wrote:

Yes - share your project.

It is shared

The webpage is http://scratch.mit.edu/projects/20413056/

Last edited by scratchFST (April 9, 2014 22:38:10)

scubajerry
Scratcher
1000+ posts

Mouse Click

Put this in all of your sprites. I tested it and it works.

when green flag clicked
forever
wait until <mouse down?>
repeat until <(not(touching [mouse-pointer v])) or (not(mouse down?)>
go to [mouse-pointer v]
end
wait until <not(mouse down?)>
end


This is the same if you like it better
when green flag clicked
forever
wait until <mouse down?>
repeat until <not((touching [mouse-pointer v]) and (mouse down?))>
go to [mouse-pointer v]
end
wait until <not(mouse down?)>
end

Last edited by scubajerry (April 10, 2014 01:29:55)

Alberknyis
Scratcher
1000+ posts

Mouse Click

when (green flag v) //category=events
forever
if <mouse down?> then

if <touching [mouse pointer v]?> then

repeat until <not <mouse down?>>
go to [mouse-pointer v]
end
else
wait until <not <mouse down?>>

end
end
end

stop [all v] ::stack

Powered by DjangoBB