Discuss Scratch

BucasBubbyloy
Scratcher
22 posts

How to make a sprite circle around a moving sprite?

I want to learn how to make a sprite circle around a moving sprite.
ShinigamiBlacky
Scratcher
100+ posts

How to make a sprite circle around a moving sprite?

forever
change [counter v] by (1)
set x to (([x v] of [Sprite1 v]) + ([radius] * ([cos v] of (counter)))
set y to (([y v] of [Sprite1 v]) + ([radius] * ([sin v] of (counter)))
end
Catalystix
Scratcher
100+ posts

How to make a sprite circle around a moving sprite?

ShinigamiBlacky is right. I made a simple demonstration of how it works using your mouse instead of a sprite.

https://scratch.mit.edu/projects/228646416/
kieranblackley
Scratcher
500+ posts

How to make a sprite circle around a moving sprite?

To make that happen it will require a few variables. It is simple once you see though.
Here is what you need to do. In the sprite that is moving make 2 variables:

Once you have made them make this script in the sprite that is moving:

Now that you have made that script go into the sprite that moves around the object that is moving (that is quite a mouthful XD).
In this sprite make a define block. To make a define block go into more blocks and click make a block.
Click on the block you see in the window and type ‘find orbit’. Next click number input. In the input you see write ‘direction’.
Click ‘Ok’ and make this script with that hat/header block:

In the same sprite make this script:

I hope this works!
Next set the rotation style to “don't rotate”.

Last edited by kieranblackley (Oct. 26, 2018 18:50:18)

DerpyHead0
Scratcher
1000+ posts

How to make a sprite circle around a moving sprite?

kieranblackley wrote:

To make that happen it will require a few variables. It is simple once you see though.
-snip-
that makes a circle on the sprite, not around it.
the topic has already been answered, it doesn't need more.
BucasBubbyloy
Scratcher
22 posts

How to make a sprite circle around a moving sprite?

Thanks guys!!
BucasBubbyloy
Scratcher
22 posts

How to make a sprite circle around a moving sprite?

I have I more question, how do you make the spinning sprite circle around slower?
badatprogrammingibe
Scratcher
500+ posts

How to make a sprite circle around a moving sprite?

ShinigamiBlacky wrote:

forever
change [counter v] by (1)
set x to (([x v] of [Sprite1 v]) + ([radius] * ([cos v] of (counter)))
set y to (([y v] of [Sprite1 v]) + ([radius] * ([sin v] of (counter)))
end
Note: Due to scratch's messed up angle system, it is better to use the following:
forever
change [counter v] by (1)
set x to (([x v] of [Sprite1 v]) + ((radius) * ([sin v] of (counter)))
set y to (([y v] of [Sprite1 v]) + ((radius) * ([cos v] of (counter)))
end
The counter in the above script represents the direction.
kieranblackley
Scratcher
500+ posts

How to make a sprite circle around a moving sprite?

DerpyHead0 wrote:

kieranblackley wrote:

To make that happen it will require a few variables. It is simple once you see though.
-snip-
that makes a circle on the sprite, not around it.
the topic has already been answered, it doesn't need more.
I did not know there was a post before I sent mine.
raddersaurs
Scratcher
3 posts

How to make a sprite circle around a moving sprite?

you can just turn it around using costumes
But it depends on what speed you want

Last edited by raddersaurs (Oct. 16, 2021 12:42:02)

NG_Web
Scratcher
50 posts

How to make a sprite circle around a moving sprite?

This really helps, friends

Powered by DjangoBB