Discuss Scratch

Happyburgerz57
Scratcher
3 posts

How to make it so when a sprite follows mouse pointer, when the mouse goes over it doesnt glitch out

Im trying to make a game where someone follows a mouse pointer, and whenever the sprite goes under the mouse pointer it glitches out and im trying to make my game as smooth as possible, anyone know how to fix this problem?
yippymishy
Scratcher
100+ posts

How to make it so when a sprite follows mouse pointer, when the mouse goes over it doesnt glitch out

when green flag clicked
forever
if <not <touching [mouse-pointer v] ?>> then
go to [mouse-pointer v]
end
end
Happyburgerz57
Scratcher
3 posts

How to make it so when a sprite follows mouse pointer, when the mouse goes over it doesnt glitch out

Well thats not really working, the way the character moves is they point towards the mouse pointer to be able to spin around in all 360 degrees and then a forever loop that makes him walk 5 steps, if I used that code it doesn't spin or anything
opalcoralsword
Scratcher
1 post

How to make it so when a sprite follows mouse pointer, when the mouse goes over it doesnt glitch out

yippymishy wrote:

when green flag clicked
forever
if <not <touching [mouse-pointer v] ?>> then
point towards [mouse-pointer v]
move (10) steps
if <touching [mouse-pointer v] ?> then
wait until <not <touching [mouse-pointer v] ?>
end
existentialcrisises
Scratcher
100+ posts

How to make it so when a sprite follows mouse pointer, when the mouse goes over it doesnt glitch out

Alternatively, what I've found that works for me is to do this:
when green flag clicked
forever
if <(distance to [mousepointer v]) > [5]> then
point towards [mousepointer v]
move (5) steps
else
go to [mousepointer v]
end
end

Edit: Sorry, didn't realise that this was an old topic.

Last edited by existentialcrisises (Dec. 1, 2023 08:59:42)

PalomaCode
New Scratcher
1 post

How to make it so when a sprite follows mouse pointer, when the mouse goes over it doesnt glitch out

when green flag clicked
forever
point towards [ mouse pointer v]
move (10) steps
end


this worked for me, but i am still having the glitch issues like you

Powered by DjangoBB