Discuss Scratch

skydanny112
Scratcher
17 posts

dragging sprites

hello,
I need some help to make multiple sprites “draggable.”
my current problem is…
when I am dragging a sprite and my mouse goes over another draggable sprite, the mouse drags both sprites at the same time.
please help me to make multiple sprites draggable.
comments featuring a picture of the scripts needed to achieve this would be helpful.
thanks.
Crimson19
Scratcher
1000+ posts

dragging sprites

whenthisspriteclickedrepeatuntilnotmousedown?andtouchingmouse-pointer?gotomouse-pointer

This way, if the sprite isn't clicked, it won't follow instead of the mouse simply being down.

Last edited by Crimson19 (Aug. 22, 2015 13:04:05)

daemys
Scratcher
100+ posts

dragging sprites

Declare a global variable called IsDragging. Set its initial value to zero. When a sprite checks the mouse state and decides to start dragging, check the value of the variable. If its zero, set it to 1 and start dragging. When you stop dragging set the value back to 0. But if a sprite sees that IsDragging is not zero, it can't start dragging.
skydanny112
Scratcher
17 posts

dragging sprites

thank you guys! I can now create a cool game. i'll be sure to mention you in the notes and credits box

Powered by DjangoBB