Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » HOW TO MAKE A SPRITE TO GO TO MOUSE POINTER BUT NOT GO ALL THE WAY
- Pabello_Aquilla
-
New Scratcher
4 posts
HOW TO MAKE A SPRITE TO GO TO MOUSE POINTER BUT NOT GO ALL THE WAY
hi, im working on a soccer game and i am trying to know how to do it, im on website, if someone can help it would be appreciated
- RokCoder
-
Scratcher
1000+ posts
HOW TO MAKE A SPRITE TO GO TO MOUSE POINTER BUT NOT GO ALL THE WAY
Hard to answer that without knowing exactly what you're trying to achieve. At its simplest, moving towards the mouse point is -
And ensuring it doesn't go too close -
set [speed v] to (5)
forever
point towards [mouse-pointer v]
move (speed) steps
And ensuring it doesn't go too close -
set [speed v] to (5)
set [nearest v] to (50)
forever
point towards [mouse-pointer v]
if <(distance to [mouse-pointer v]) > (nearest)> then
move (speed) steps
- seventhper7
-
Scratcher
8 posts
HOW TO MAKE A SPRITE TO GO TO MOUSE POINTER BUT NOT GO ALL THE WAY
Here is something that sometimes works for me: create a blank sprite and make that follow your mouse. Then, all you need to do is make your sprite follow the “blank” sprite.
- Pabello_Aquilla
-
New Scratcher
4 posts
HOW TO MAKE A SPRITE TO GO TO MOUSE POINTER BUT NOT GO ALL THE WAY
what i am trying to say is you click a button (for example is i press 1 on my keyboard) then a sprite goes to the mouse but stops before reaching,
also i want the ball to go at where the mouse it but its gonna stop before it reaches the mouse
also i want the ball to go at where the mouse it but its gonna stop before it reaches the mouse
- Discussion Forums
- » Help with Scripts
-
» HOW TO MAKE A SPRITE TO GO TO MOUSE POINTER BUT NOT GO ALL THE WAY


