Discuss Scratch

ImagineOne
New Scratcher
1 post

Smooth Mouse Follow

Hey everyone!
I need help with something. I'd like to create a game with smooth mouse following, as the regular way to do it is rather jerky.
Example:
when green flag clicked
forever
set x to (mouse x)
end
when green flag clicked
forever
set y to (mouse y)
end

Is it possible to make it delayed to create smoother mouse movements? Any help is welcome. Thanks a ton!
asivi
Scratcher
1000+ posts

Smooth Mouse Follow

point towards [mouse-pointer v]
move (3) steps
Breck-
Scratcher
100+ posts

Smooth Mouse Follow

Or even smoother:

forever
point in direction (mouse-pointer)
move ((distance to [mouse-pointer]) / (#)) steps
end

The # can be any number from 1-20, 1 makes it fast, 20 makes it slow.
footsocktoe
Scratcher
1000+ posts

Smooth Mouse Follow

ImagineOne wrote:

Hey everyone!
I need help with something. I'd like to create a game with smooth mouse following, as the regular way to do it is rather jerky.
Example:
when green flag clicked
forever
set x to (mouse x)
end
when green flag clicked
forever
set y to (mouse y)
end

Is it possible to make it delayed to create smoother mouse movements? Any help is welcome. Thanks a ton!

By a useful coincidence I just happened to favorite a mouth smoothing project today. It was … https://scratch.mit.edu/projects/119313108/
WierdoGuy11111
Scratcher
28 posts

Smooth Mouse Follow

Hi Everyone!
The Easiest Way I Find To Make A Smooth Mouse Follow Is
when green flag clicked
set rotation style [don't rotate v]
forever
point towards (mouse-pointer v)
move ((distance to (mouse-pointer v)) / (5)) steps
end
or you can do
when green flag clicked
forever
go to x: ((x position) + (((mouse x) - (x position)) / (12))) y: ((y position) + (((mouse y) - (y position)) / (12)))
end

Last edited by WierdoGuy11111 (Oct. 7, 2022 04:13:57)

Dragon_Egg_Fish
Scratcher
100+ posts

Smooth Mouse Follow

WierdoGuy11111 wrote:

Hi Everyone!
The Easiest Way I Find To Make A Smooth Mouse Follow Is
when green flag clicked
set rotation style [don't rotate v]
forever
point towards (mouse-pointer v)
move ((distance to (mouse-pointer v)) / (5)) steps
end
or you can do
when green flag clicked
forever
go to x: ((x position) + (((mouse x) - (x position)) / (12))) y: ((y position) + (((mouse y) - (y position)) / (12)))
end
this topic is really old
pls try not to necropost
also close your tags

Powered by DjangoBB