Discuss Scratch

Charizard744
Scratcher
8 posts

Dragging

How would you make for example, a sprite move by dragging WITHOUT putting your cursor on the sprite at all.
Gamdapiko24
Scratcher
57 posts

Dragging

what do you mean?
PaSc_Clan
Scratcher
64 posts

Dragging

Is this what you're looking for?

when green flag clicked
forever
if <mouse down?> then
set [dx v] to ((x position) - (mouse x))
set [dy v] to ((y position) - (mouse y))
repeat until <not <mouse down?>>
go to x: ((mouse x) + (dx)) y: ((mouse y) + (dy))
end
end
end
Ym2612
Scratcher
43 posts

Dragging

do you mean making a sprite follow the mouse?
Charizard744
Scratcher
8 posts

Dragging

Ym2612 wrote:

do you mean making a sprite follow the mouse?
Like I mean you drag on the screen and the sprite moves without touching the sprite.
Charizard744
Scratcher
8 posts

Dragging

Gamdapiko24 wrote:

what do you mean?
So like you drag your finger/cursor on the screen and it moves a sprite even tough you're not touching the sprite.
PaSc_Clan
Scratcher
64 posts

Dragging

Charizard744 wrote:

Gamdapiko24 wrote:

what do you mean?
So like you drag your finger/cursor on the screen and it moves a sprite even tough you're not touching the sprite.

I provided code that does just that.

PaSc_Clan wrote:

Is this what you're looking for?

when green flag clicked
forever
if <mouse down?> then
set [dx v] to ((x position) - (mouse x))
set [dy v] to ((y position) - (mouse y))
repeat until <not <mouse down?>>
go to x: ((mouse x) + (dx)) y: ((mouse y) + (dy))
end
end
end
Charizard744
Scratcher
8 posts

Dragging

PaSc_Clan wrote:

Is this what you're looking for?

when green flag clicked
forever
if <mouse down?> then
set [dx v] to ((x position) - (mouse x))
set [dy v] to ((y position) - (mouse y))
repeat until <not <mouse down?>>
go to x: ((mouse x) + (dx)) y: ((mouse y) + (dy))
end
end
end
Yes, thank you!

Powered by DjangoBB