Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do i make my character follow the cursor
- coder9902htm4a0
-
Scratcher
51 posts
How do i make my character follow the cursor
I want to make my character follow my cursor how do i do it?
- AonymousGuy
-
Scratcher
1000+ posts
How do i make my character follow the cursor
when gf clickedWill simulate a dragging effect.
forever
go to [mouse pointer v]
end
But,
when gf clickedWill make the character move towards the mouse pointer from its current position.
forever
point towards [mouse pointer v]
move (10) steps
end
Hope this helps!
- coder9902htm4a0
-
Scratcher
51 posts
How do i make my character follow the cursor
Never mind,i figured it out, but thanks!when gf clickedWill simulate a dragging effect.
forever
go to [mouse pointer v]
end
But,when gf clickedWill make the character move towards the mouse pointer from its current position.
forever
point towards [mouse pointer v]
move (10) steps
end
Hope this helps!
- platypusProductions
-
Scratcher
1 post
How do i make my character follow the cursor
I used AonymousGuy's script for following but the sprite spazes if it gets too close. I'd like to fix that but I don't know how! Please help.
- coder9902htm4a0
-
Scratcher
51 posts
How do i make my character follow the cursor
I used AonymousGuy's script for following but the sprite spazes if it gets too close. I'd like to fix that but I don't know how! Please help.Well, if I understand correctly, as far as i'm concerned there's not really a workaround to that

- drmcw
-
Scratcher
1000+ posts
How do i make my character follow the cursor
I used AonymousGuy's script for following but the sprite spazes if it gets too close. I'd like to fix that but I don't know how! Please help.
forever
repeat until <(distance to [mouse pointer v]) < [10]> // choose whatever minimum distance you want
point towards [mouse pointer v]
move (10) steps
end
end
Last edited by drmcw (Dec. 6, 2013 21:38:58)
- owlpillow
-
Scratcher
49 posts
How do i make my character follow the cursor
by the way, if you want it on the cursor
forever loop
set x to mouse x
set y to mouse y
forever loop
forever loop
set x to mouse x
set y to mouse y
forever loop
- Failord
-
Scratcher
1000+ posts
How do i make my character follow the cursor
Here's a couple of smoother-looking, less glitchy ways:
^This allows it to follow smoothly without turning. You can't adjust the speed, unfortunately.
If you want to adjust speed and point towards the mouse, use this:
You can also use these for following sprites as well. The /2 in the second script can be adjusted to control follow speed. If you want your sprite not to turn, set the rotation style to “don't rotate.”
Hope this helped!
repeat until <whatever you want it to sense for stopping>
go to x: (((mouse x) + (x position)) / (2)) y: (((mouse y) + (y position)) / (2))
end
^This allows it to follow smoothly without turning. You can't adjust the speed, unfortunately.
If you want to adjust speed and point towards the mouse, use this:
repeat until <whatever you want it to sense for stopping>
point towards [mouse pointer v]
move ((distance to [mouse pointer v]) / (2)) steps
end
You can also use these for following sprites as well. The /2 in the second script can be adjusted to control follow speed. If you want your sprite not to turn, set the rotation style to “don't rotate.”
Hope this helped!
- Failord
-
Scratcher
1000+ posts
How do i make my character follow the cursor
by the way, if you want it on the cursor
forever loop
set x to mouse x
set y to mouse y
forever loop
You mean,
go to [mouse-pointer v]?
- ARM32
-
Scratcher
38 posts
How do i make my character follow the cursor
I used AonymousGuy's script for following but the sprite spazes if it gets too close. I'd like to fix that but I don't know how! Please help.
How to fix that is do this:
when green flag clicked
forever
if <not <(distance to [mouse-pointer v]) < [11]>> then
move (10) steps
end
point towards [mouse-pointer v]
end
- AonymousGuy
-
Scratcher
1000+ posts
How do i make my character follow the cursor
I used AonymousGuy's script for following but the sprite spazes if it gets too close. I'd like to fix that but I don't know how! Please help.
when gf clicked
forever
point towards [mouse pointer v]
if <(distance to [mouse pointer v]) > [10]>
move (10) steps
end
end
EDIT: Oops, used less than instead of greater than. Fixed!
Last edited by AonymousGuy (Dec. 9, 2013 00:11:33)
- scubajerry
-
Scratcher
1000+ posts
How do i make my character follow the cursor
I used AonymousGuy's script for following but the sprite spazes if it gets too close. I'd like to fix that but I don't know how! Please help.when gf clicked
forever
point towards [mouse pointer v]
if <(distance to [mouse pointer v]) > [10]>// I think this should be greater than.
move (10) steps
end
end
Fixed
- skullboy22
-
Scratcher
99 posts
How do i make my character follow the cursor
when green flag clicked
forever
go to [mouse-pointer]
end
if you want to make it follow the mouse pointer do it how I did cuz its less complicated
Last edited by skullboy22 (Dec. 8, 2013 22:04:55)
- pongynose
-
Scratcher
76 posts
How do i make my character follow the cursor
when green flag clicked
forever
go to mouse pointer
end


- 12424
-
Scratcher
65 posts
How do i make my character follow the cursor
when green flag clicked
forever
go to mouse pointer
end
Did you mean
when green flag clicked
forever
go to [mouse pointer v]
end
- Polaris10
-
Scratcher
63 posts
How do i make my character follow the cursor
“I want to make my character follow my cursor. Can someone please tell me how i do it?”
when green flag clicked
forever
go to [mouse pointer]
end
Last edited by Polaris10 (July 7, 2015 22:12:05)
- CatsUnited
-
Scratcher
1000+ posts
How do i make my character follow the cursor
Please don't necropost.
- Discussion Forums
- » Help with Scripts
-
» How do i make my character follow the cursor













