how can i draw horizontal circles?
Author |
Message |
trish
|
Posted: Thu Sep 23, 2004 6:40 pm Post subject: how can i draw horizontal circles? |
|
|
okay sorry about my other post and also about watever discomfort it caused 2 a memeber...well since u myt all think that i just decided to make u do my homework i'm not so here's wat i've been doing...
setscreen ("graphics:640;480")
var x, sides : int
sides := 30
x := 40
for i : 1 .. 8
drawoval (x, 200, sides, sides, 2)
x += 1
exit when x > 60
end for
so can anyone tell me how i can make a horizontal line of circle or please tell me wat i'm doing wrong in this program |
|
|
|
|
|
Sponsor Sponsor
|
|
|
AsianSensation
|
Posted: Thu Sep 23, 2004 6:45 pm Post subject: (No subject) |
|
|
well, there are bunch of stuff here that needs fixed.
First, there shouldn't be an exit statement in a for loop unless you want early termination.
Second, you are increasing the x coordinate by 1 each time. The 1 stands for 1 pixel length. But you want the circles to be drawn side by side. So instead of increasing by 1, you should increase by the diameter of the circle.
so your finishing code would look something like this:
code: | setscreen ("graphics:640;480")
var x, sides : int
sides := 30
x := 40
for i : 1 .. 8
drawoval (x, 200, sides, sides, 2)
x += sides * 2
end for |
|
|
|
|
|
|
trish
|
Posted: Thu Sep 23, 2004 6:56 pm Post subject: (No subject) |
|
|
thanks but can i ask wat the 2 was for? |
|
|
|
|
|
Andy
|
Posted: Thu Sep 23, 2004 7:12 pm Post subject: (No subject) |
|
|
so u leave enuff space for the nxt circle... since ur circle has a radius of "sides", you have to leave twice that much so the circles dont overlap |
|
|
|
|
|
Dan
|
Posted: Fri Sep 24, 2004 5:41 pm Post subject: (No subject) |
|
|
Grrr, you should have not made a 2nd topic for this when it is realy the same question but rather just replyed to the 1st one. One good way of finding out the rules and what is acpeteable to poleop on a froum is to look at the rules post (in GD) and the how do i ask a question, the so you are looking for help and the rules posts in this section as well. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
|
|