Discuss Scratch

uzytpl
Scratcher
38 posts

How can I make a sprite SLOWLY turn to face my mouse?

Hi! I want my sprite to have a bit of a delay when turning to face my mouse. I don't want it to always face my mouse, I want it to turn in order to follow my mouse, but i want it to take some time.

It should follow the mouse, and not face it the entire time.

How do I do that? Does anyone know?
I really need that cause I've abandoned a few projects already because I couldn't quite figure that out.
Thank you in advance for taking your time to answer this question. I'll rbe really thankful cause I really need this
help_with_scripts
Scratcher
100+ posts

How can I make a sprite SLOWLY turn to face my mouse?

uzytpl wrote:

Hi! I want my sprite to have a bit of a delay when turning to face my mouse. I don't want it to always face my mouse, I want it to turn in order to follow my mouse, but i want it to take some time.

It should follow the mouse, and not face it the entire time.

How do I do that? Does anyone know?
I really need that cause I've abandoned a few projects already because I couldn't quite figure that out.
Thank you in advance for taking your time to answer this question. I'll rbe really thankful cause I really need this
You can use mouse x and mouse y blocks to find where the sprite needs to point towards and use turn () degress with wait blocks.
help_with_scripts
Scratcher
100+ posts

How can I make a sprite SLOWLY turn to face my mouse?

uzytpl wrote:

Hi! I want my sprite to have a bit of a delay when turning to face my mouse. I don't want it to always face my mouse, I want it to turn in order to follow my mouse, but i want it to take some time.

It should follow the mouse, and not face it the entire time.

How do I do that? Does anyone know?
I really need that cause I've abandoned a few projects already because I couldn't quite figure that out.
Thank you in advance for taking your time to answer this question. I'll rbe really thankful cause I really need this
Here, just add wait blocks:
https://scratch.mit.edu/projects/441169428/
awesome_guy6856
Scratcher
100+ posts

How can I make a sprite SLOWLY turn to face my mouse?

define turning
set [original direction v] to (direction)
point towards [mouse v]
set [target direction v] to (direction)
point in direction (original direction)
if <(direction) > (target direction)> then
turn cw (turnSpeed) degrees
if <(direction) < (target direction)> then
point towards [mouse v]
end
else
turn ccw (turnSpeed) degrees
if <(direction) > (target direction)> then
point towards [mouse v]
end
end

when green flag clicked
set [turnSpeed v] to [15]
forever
turning :: more blocks
wait (0.1) secs
end

Last edited by awesome_guy6856 (Oct. 26, 2020 17:36:45)

uzytpl
Scratcher
38 posts

How can I make a sprite SLOWLY turn to face my mouse?

Btw, I have already found a solution to the problem, but thanks for the answers anyway. They all may come in handy one day

Powered by DjangoBB