This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-01-03 10:36:57

samtatr
New Scratcher
Registered: 2011-01-03
Posts: 5

Circular Movement

If I want a character to move in a circle, ie - they follow the path of an invisible circle, how would I do it? I know you can manually do
[blocks]
<go to x sad 0)y sad 1)>
<go to x sad 0)y sad 2)>
[/blocks]
Or something like that, but ideally, there would be an easier way. Is there? And if there is could you tell me it?
Thanks so much.

Offline

 

#2 2011-01-03 10:41:51

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Circular Movement

Try [Change X by <sine of 1>] and [Change Y by <Cosine of 1>] in a repeat by 360 block.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#3 2011-01-03 10:44:41

samtatr
New Scratcher
Registered: 2011-01-03
Posts: 5

Re: Circular Movement

I dont quite understand. Could you use the blocks below the message to explain if possible?

Offline

 

#4 2011-01-03 11:00:52

samtatr
New Scratcher
Registered: 2011-01-03
Posts: 5

Re: Circular Movement

Where are sine and cosine? Do you mean sin and cos, because ive tried those and it doesnt work
[blocks]
<repeat( 360
<change x by( sin of 1<end>
<change y by( cos of 1</end>
<end>

Offline

 

#5 2011-01-03 11:07:20

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: Circular Movement

Try this:

http://img401.imageshack.us/img401/705/moveincircle.gif

(click on it if it is too small)

Last edited by scmb1 (2011-01-03 11:08:30)


http://i48.tinypic.com/2z5pqad.png

Offline

 

#6 2011-01-03 11:15:10

Wolfie1996
Retired Community Moderator
Registered: 2009-07-08
Posts: 1000+

Re: Circular Movement

For a simpler method, try something like:

Code:

point in direction ( 0 )
repeat ( 360 )
 Turn ( 1 ) degrees [you can use either direction]
 Move ( 1 ) steps [change the number to make a bigger/smaller circle]

If you want the sprite to face the same way the whole time, just click the square in the Sprite Header Pane, which will make the sprite look as if it is facing 90 degrees the whole time, without affecting (effecting? I'm not sure  hmm ) the script.


"...Jargon - the practice of never calling a spade a spade, when you might instead call it a manual earth-restructing implement..." - Bill Bryson, Mother Tongue

Offline

 

#7 2011-01-03 11:22:56

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: Circular Movement

Wolfie1996 wrote:

For a simpler method, try something like:

Code:

point in direction ( 0 )
repeat ( 360 )
 Turn ( 1 ) degrees [you can use either direction]
 Move ( 1 ) steps [change the number to make a bigger/smaller circle]

If you want the sprite to face the same way the whole time, just click the square in the Sprite Header Pane, which will make the sprite look as if it is facing 90 degrees the whole time, without affecting (effecting? I'm not sure  hmm ) the script.

Yeah, it's "affecting."  smile  (Affect is a verb and effect is a noun)

But... on topic:

I recommend using Wolfie's method, especially if you aren't too familiar with trig. The only time I can think of that you should use the trig method is if the spite might hit the edges because with the rotation method, hitting the edge totally mess up the path.


http://i48.tinypic.com/2z5pqad.png

Offline

 

#8 2011-01-03 11:24:33

samtatr
New Scratcher
Registered: 2011-01-03
Posts: 5

Re: Circular Movement

It worked, thank you so much

Offline

 

Board footer