Discuss Scratch

90999988
Scratcher
45 posts

How do i make a smooth point at mouse pointer?

Hi! Small creators like me feel free to use this to help. But thats not the reason i created this.
How do i create smooth pointing at the mouse pointer?
Heres the code that doesnt work.
when green flag clicked
forever
point towards [Mouse pointer v]

Formal Scratcher Welcoming Community (Unofficial) Owner
I love to share everything i create in scratch with the world!
Malicondi
Scratcher
1000+ posts

How do i make a smooth point at mouse pointer?

You can use this block to smoothly point towards the mouse pointer, I recommend using a smoothness of 6 or 7:
define point to mouse with smoothness (s)
set (cd) to (direction)
point towards [mouse pointer v]
set (td) to (direction)
set [d v] to (((((td) - (cd)) + (180)) mod (360)) - (180))
if <([abs v] of (d)) < (s)> then
else
point in direction ((cd) + (((d) / ([abs v] of (d))) * (s)))
keep in mind, this needs to be in a repeat or forever loop, or it will only turn a small amount. Hope this helps!

post #1000 post #100 i help in the forums post #1 post #500 0 second ninja
I recommend reading jvvg's essay about the scratch team before complaining, as it may change your opinion and provide insight on the topic.

coming soon :)


90999988
Scratcher
45 posts

How do i make a smooth point at mouse pointer?

Malicondi wrote:

(cd)
[/quote]
is this a all sprites or only?

Formal Scratcher Welcoming Community (Unofficial) Owner
I love to share everything i create in scratch with the world!
90999988
Scratcher
45 posts

How do i make a smooth point at mouse pointer?

Thanks it worked

Last edited by 90999988 (March 23, 2024 17:18:42)


Formal Scratcher Welcoming Community (Unofficial) Owner
I love to share everything i create in scratch with the world!
Malicondi
Scratcher
1000+ posts

How do i make a smooth point at mouse pointer?

90999988 wrote:

I meant
(cd)

Is this a all sprites or an only sprites
for clones, for this sprite only, for a sprite, can be either.

post #1000 post #100 i help in the forums post #1 post #500 0 second ninja
I recommend reading jvvg's essay about the scratch team before complaining, as it may change your opinion and provide insight on the topic.

coming soon :)


SpyCoderX
Scratcher
100+ posts

How do i make a smooth point at mouse pointer?

90999988 wrote:

Hi! Small creators like me feel free to use this to help. But thats not the reason i created this.
How do i create smooth pointing at the mouse pointer?
Heres the code that doesnt work.
when green flag clicked
forever
point towards [Mouse pointer v]
Well, there is this method to turn at a fixed rate:
Credit: RokCoder
define Turn towards mouse
set [current direction v] to (direction)
point towards [mouse v]
set [target direction v] to (direction)
set [delta direction v] to (((((target direction) - (current direction)) + (180)) mod (360)) - (180))
if <([abs v] of (delta direction)) < (rotation speed*)> then // *rotation speed is the speed at which you want to turn towards the mouse pointer
point in direction (target direction)
else
point in direction ((current direction) + (((delta direction) / ([abs v] of (delta direction))) * (rotation speed*)))
end

You can also use this to turn a certain % at a time:
define Turn towards mouse
set [current direction v] to (direction)
point towards [mouse v]
set [target direction v] to (direction)
set [delta direction v] to ((((((target direction) - (current direction)) + (180)) mod (360)) - (180)) + (current direction))
point in direction (((current direction) * ((1)-(rotation percent*))) + ((delta direction) * (rotation percent*))) //Rotation percent* is a value between 0 and 1

Last edited by SpyCoderX (March 23, 2024 17:43:11)


New game! (link)
Have a good day/night!


\(-_-) ::#00AAAA //This is crypto. He protects my signature from the evil kumquats!
Programming is a very powerful skill. As are critical thinking and hard work.
- SpyCoderX


90999988
Scratcher
45 posts

How do i make a smooth point at mouse pointer?

I already did it.

Formal Scratcher Welcoming Community (Unofficial) Owner
I love to share everything i create in scratch with the world!
gggggggggghdfdc
Scratcher
1 post

How do i make a smooth point at mouse pointer?

war are the bloks
kiwilover2736
Scratcher
1000+ posts

How do i make a smooth point at mouse pointer?

gggggggggghdfdc wrote:

war are the bloks
What?

⋆˖⁺‧₊☽ Just a person who helps in and cleans up the Discussion Forums! ☾₊‧⁺˖⋆

⋆˖⁺ I reached 1000 followers in January of 2024 and made an QNA. I'm now done with answering all the questions, and here's the project for it! ⁺˖⋆

⋆˖⁺ One of my projects was featured! :‎D Check it out here! ⁺˖⋆

⋆˖⁺ Murder Drones fan! ⁺˖⋆ (Note: Murder Drones is an Indie Show.)




———————————————————————————————————————————————

RANDOM SCRATCHERS OUT OF CONTEXT :‎D


Za-Chary once said..

Za-Chary wrote:

Could you remind us what scenes are in ScratchJr and what they do?

alphabetlorefan2003 wrote:

If this gets rejected, add this to Za-Chary!
After all, I AM the list of rejected suggestions.


And Paddle2See once said..

Paddle2See wrote:

This is not a question for this forum. It's a question for your lawyer.


~Congrats! You found secret links. These are just random images that i might use.~

u.cubeupload.com/eason_9_lol/SxrJFv.png
u.cubeupload.com/eason_9_lol/Wf472Y.png
u.cubeupload.com/eason_9_lol/a8wDJ4.png
90999988
Scratcher
45 posts

How do i make a smooth point at mouse pointer?

Guys this post is done, No need to comment on it.

Formal Scratcher Welcoming Community (Unofficial) Owner
I love to share everything i create in scratch with the world!
kiwilover2736
Scratcher
1000+ posts

How do i make a smooth point at mouse pointer?

90999988 wrote:

Guys this post is done, No need to comment on it.
You can report your topic and tell the Scratch Team to close the topic in the report reason. Then no new people will be able to post.

⋆˖⁺‧₊☽ Just a person who helps in and cleans up the Discussion Forums! ☾₊‧⁺˖⋆

⋆˖⁺ I reached 1000 followers in January of 2024 and made an QNA. I'm now done with answering all the questions, and here's the project for it! ⁺˖⋆

⋆˖⁺ One of my projects was featured! :‎D Check it out here! ⁺˖⋆

⋆˖⁺ Murder Drones fan! ⁺˖⋆ (Note: Murder Drones is an Indie Show.)




———————————————————————————————————————————————

RANDOM SCRATCHERS OUT OF CONTEXT :‎D


Za-Chary once said..

Za-Chary wrote:

Could you remind us what scenes are in ScratchJr and what they do?

alphabetlorefan2003 wrote:

If this gets rejected, add this to Za-Chary!
After all, I AM the list of rejected suggestions.


And Paddle2See once said..

Paddle2See wrote:

This is not a question for this forum. It's a question for your lawyer.


~Congrats! You found secret links. These are just random images that i might use.~

u.cubeupload.com/eason_9_lol/SxrJFv.png
u.cubeupload.com/eason_9_lol/Wf472Y.png
u.cubeupload.com/eason_9_lol/a8wDJ4.png
90999988
Scratcher
45 posts

How do i make a smooth point at mouse pointer?

kiwilover2736 wrote:

90999988 wrote:

Guys this post is done, No need to comment on it.
You can report your topic and tell the Scratch Team to close the topic in the report reason. Then no new people will be able to post.

Okay.

Formal Scratcher Welcoming Community (Unofficial) Owner
I love to share everything i create in scratch with the world!

Powered by DjangoBB