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

#1 2012-06-11 20:55:19

wiyaya
New Scratcher
Registered: 2012-03-12
Posts: 1

Circle

How do you make sprite make a perfect circle slowly? The one that is suggested when i cliked with my left on "turn" didn't really make a circle...

Offline

 

#2 2012-06-11 20:59:02

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: Circle

Turn while moving.


Get ready for domination of:  tongue

Offline

 

#3 2012-06-11 21:15:34

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: Circle

You can set the rotation center of the costume to the center of the circle, and then try this script:

when I receive [draw]
clear
repeat (360)
turn cw (1) degrees
stamp
end


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#4 2012-06-11 21:27:45

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Circle

when I receive [Draw Circle v]
pen up
clear
go to x:(0) y:(0)
repeat (90)
turn cw (4) degrees
move (1) steps
end


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#5 2012-06-11 21:29:34

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: Circle

MoreGamesNow wrote:

...some script....

I think you also need a pen down in there, so:

when I receive [Draw Circle v]
pen up
clear
go to x:(0) y:(0)
pen down
repeat (90)
turn cw (4) degrees
move (1) steps
end
pen up


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#6 2012-06-11 22:00:57

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Circle

jvvg wrote:

I think you also need a pen down in there, so:

Thanks, can't believe I overlooked that xD


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#7 2012-06-12 10:52:57

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Circle

when gf clicked
set [angle v] to (0)
forever
go to x:((([cos v] of (angle)) * (radius)) + (origin x)) y:((([sin v] of (angle)) * (radius)) + (origin x))
change [angle v] by (1)
wait (x) secs
Where origin x and y are the circle's center coords, you could do an angle limiter eg.ifangle = 360 set angle to 0

Last edited by zammer990 (2012-06-12 12:22:38)


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#8 2012-06-12 11:35:25

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Circle

zammer990 wrote:

when gf clicked
set [angle v] to (0)
forever
go to x:((([sin v] of (angle)) * (radius)) + (origin x)) y:((([cos v] of (angle)) * (radius)) + (origin y))
change [angle v] by (1)
wait (x) secs
Where origin x and y are the circle's center coords, you could do an angle limiter eg.ifangle = 369 set angle to 0

Fixed.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#9 2012-06-12 12:24:30

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Circle

AtomicBawm3 wrote:

zammer990 wrote:

when gf clicked
set [angle v] to (0)
forever
go to x:((([sin v] of (angle)) * (radius)) + (origin x)) y:((([cos v] of (angle)) * (radius)) + (origin y))
change [angle v] by (1)
wait (x) secs
Where origin x and y are the circle's center coords, you could do an angle limiter eg.ifangle = 369 set angle to 0

Fixed.

Either way works,  sine draws from the top, cosine from the side


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#10 2012-06-12 13:00:10

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Circle

zammer990 wrote:

...you could do an angle limiter e.g. if angle = 360 set angle to 0

Perhaps you're looking for the Modulo operation (often known as just mod).  Include a block like this within the forever loop. 

set [angle v] to ((angle) mod (360))
But, if you're using trigonometric functions, it won't matter whether the input is greater than 360, because

sin(25) = sin(25 + 360) = sin(25 + 720) = sin(25 + 360n)

where n is an integer.

Offline

 

Board footer