Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Can anyone help me figure out how to keep relative position while still following a sprite?
- DrywallDaGoober_
-
Scratcher
3 posts
Can anyone help me figure out how to keep relative position while still following a sprite?
For example, I want a fireball to circle around my sprite while its also moving
- awesome-llama
-
Scratcher
1000+ posts
Can anyone help me figure out how to keep relative position while still following a sprite?
I'll show two options…
1. Motion blocks
2. Trigonometry
This one is a bit too long for the page, here it is again with variables:
Swap the sin and cos if you want the angles to be the same as Scratch's directions.
1. Motion blocks
point in direction (90)
forever
turn cw (10) degrees // make the sprite constantly rotate
go to [player v] // go to the center of the circle
move (50) steps // move away from the center by the circle radius
end
2. Trigonometry
set [angle v] to [0]
forever
change [angle v] by (10)
go to x: (([x position v] of [player v]) + (([cos v] of (angle)::operators) * (50))) y: (([y position v] of [player v]) + (([sin v] of (angle)::operators) * (50)))
end
This one is a bit too long for the page, here it is again with variables:
go to x: ((player x) + (([cos v] of (angle)::operators) * (50))) y: ((player y) + (([sin v] of (angle)::operators) * (50)))
Swap the sin and cos if you want the angles to be the same as Scratch's directions.
Last edited by awesome-llama (June 16, 2025 07:36:37)
- DrywallDaGoober_
-
Scratcher
3 posts
Can anyone help me figure out how to keep relative position while still following a sprite?
Thanks 

- Discussion Forums
- » Help with Scripts
-
» Can anyone help me figure out how to keep relative position while still following a sprite?