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

#1 2009-09-05 04:55:39

Thilo
Scratcher
Registered: 2009-03-31
Posts: 24

Dashed circle

Hi everybody!

I'm trying to paint a part of a circle with a dashed line, but it won't come up to me in an easy way. Mayby somebody can help.

The following things work fine so far:

1. I'm able to paint a circle automatically arround the point of origin with a radius of 139. The program starts drawing the circle at x=139; y=0. That's the code:


<set{ angle }to( 0
<set{ radius }to( 139
<set{ r }to( radius
<go to x sad  r )y sad  0
<repeat until> <( angle <=> 365 )>
<go to x sad  (( <cos( angle <*> r )) )y sad  (( <sin( angle <*> r ))
<change{ angle }by( 5

2. I'm able to start drawing a line at the position x=0; y=139  (angle = 90 degree) using <pen down> and stop drawing the line of the circle at an angle of 130 degree using <pen up>.

That's what's work. What I wanna do now is:

The part of the circle between 90 degree and 130 degree should be dashed!! It works with the following solution, which is very poor, I think (in the <repeat until> loop and under <change{ angle }by( 5 of the code above)

<if> <( angle <=> 95 )>
<pen down>
<if> <( angle <=> 100 )>
<pen up>

.
.
.

<if> <( angle <=> 130 )>
<pen up>

That's a lot of code and I'm sure there's a more efficient way, because drawing a dasched line between 90 degree and 180 degree would be the next step.

Can anybody help?

Offline

 

#2 2009-09-06 07:40:26

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Dashed circle

I made this:
http://scratch.mit.edu/projects/justtestingstickman/672874
Not sure if it's EXACTLY what you want though.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#3 2009-09-06 08:28:59

Thilo
Scratcher
Registered: 2009-03-31
Posts: 24

Re: Dashed circle

Thanks for your effort, juststickman!

That's almost exactly what I want. In the meantime I found myself another solution, which works fine. I'd like to show you but I made the project in BYOB.

Offline

 

Board footer