Discuss Scratch

ColtPanther2016
New Scratcher
1 post

how do you make a sprite follow your mouse?

how do you make a sprite follow your mouse? help?!
21lyoja
Scratcher
100+ posts

how do you make a sprite follow your mouse?

forever
point towards [mouse-pointer v]
move (4) steps
end
drmcw
Scratcher
1000+ posts

how do you make a sprite follow your mouse?

Be careful with the
point towards [mouse-pointer v]
block as It currently has a bug and doesn't work when just dragged into a project. To fix; just re-select mouse-pointer from the block's drop down menu.
Thiplol
Scratcher
100+ posts

how do you make a sprite follow your mouse?

forever
go to [mouse]
end
jacquesimo
Scratcher
100+ posts

how do you make a sprite follow your mouse?

when green flag clicked
forever
go to [mouse pointer v]
end

Or

when green flag clicked
forever
point towards [mouse pointer v]
move (5) steps //Speed replaces 5
end

p.s. Don't forget this!

when green flag clicked
go to x: (0) y: (0)
Jagged-tail
Scratcher
8 posts

how do you make a sprite follow your mouse?

21lyoja wrote:

forever
point towards [mouse-pointer v]
move (4) steps
end
That points, not goes to.
this should help:
when green flag clicked
forever
go to [Mouspointer]
end
asivi
Scratcher
1000+ posts

how do you make a sprite follow your mouse?

Jagged-tail wrote:

21lyoja wrote:

forever
point towards [mouse-pointer v]
move (4) steps
end
That points, not goes to.
this should help:
when green flag clicked
forever
go to [Mouspointer]
end
Please read the original post

ColtPanther2016 wrote:

how do you make a sprite follow your mouse? help?!
-Spectrum
Scratcher
500+ posts

how do you make a sprite follow your mouse?

ColtPanther2016 wrote:

how do you make a sprite follow your mouse? help?!
To make a sprite follow your mouse forever, all you need is a very simple script:

when flag clicked
forever
go to [mouse pointer v]
end

The sprite will act as if it is stuck to your mouse. If you use this script, which many people have been suggesting . . .

when flag clicked
forever
point towards [mouse pointer v]
end

. . . then it won't actually work, at least not for what I think you're trying to do.
You could also replace the ‘go to mouse pointer’ block with this, although there's no point really:

go to x: (mouse x) y: (mouse y)

I hope that helps, this topic has been getting a little confusing with all the answers!

drmcw
Scratcher
1000+ posts

how do you make a sprite follow your mouse?

-Spectrum wrote:

If you use this script, which many people have been suggesting . . .

when flag clicked
forever
point towards [mouse pointer v]
end

. . . then it won't actually work, at least not for what I think you're trying to do.
That's why each person who suggested it has added a move block to the loop so it will work. You just need to be careful of the scratch bug associated with that block and just re-select mouse-pointer from the blocks menu to fix.
Ph0enix3000
Scratcher
94 posts

how do you make a sprite follow your mouse?

when green flag clicked
forever
go to [mouse pointer v]
end

or

when green flag clicked
forever
point towards [mouse pointer v]
move (10) steps
end
moss-shadow
Scratcher
500+ posts

how do you make a sprite follow your mouse?

Here's a harder but cooler way:
when green flag clicked
forever
wait (.1) secs
set [x v] to (mouse x)
set [y v] to (mouse y)
end

when green flag clicked
forever
glide (.1) secs to x: (X) y: (Y)
end
harryhorseharp
Scratcher
10 posts

how do you make a sprite follow your mouse?

when green flag clicked
forever
go to [ mouse pointer]
end

Powered by DjangoBB