help with loops and shape drawings please
Author |
Message |
dmitrip
|
Posted: Thu Feb 15, 2007 12:23 pm Post subject: help with loops and shape drawings please |
|
|
hello
i need to make a square and a circle drawn on the same spot 10 times but make it seem that each shape is being drawn on top of the last.
this is the code that i got soo far..
[code]
var circle,square: int
for i : 0 .. 10
circle := i + white
square := white + i
delay (300)
drawfilloval (340, 200, 150, 150, circle)
drawfillbox (200, 70, 480, 330, square )
end for
[code]
can anybody please tell me what i can do from here i seem to be stuck
thankss |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
MysticVegeta

|
Posted: Thu Feb 15, 2007 12:50 pm Post subject: Re: help with loops and shape drawings please |
|
|
code: | var circle, square : int
for i : 0 .. 10
circle := i + white
square := white + i
drawfilloval (340, 200, 150, 150, circle)
delay (200)
cls
drawfillbox (200, 70, 480, 330, square)
delay (200)
cls
end for
|
the cls clears the screen, i would suggest you have delays after both drawings otherwise it would mess up the animation |
|
|
|
|
 |
romantic_programmer

|
Posted: Thu Feb 15, 2007 6:55 pm Post subject: Re: help with loops and shape drawings please |
|
|
You really don't need that extra cls. and another tip if you put the drawfillbox first it give it a neater effect of being drawn. kinda like this
code: | var circle, square : int
for i : 0 .. 10
circle := i + 3
square := i + 1
drawfillbox (210, 70, 470, 330, square)
delay (500)
drawfilloval (340, 200, 130, 130, circle)
delay (500)
cls
end for |
also i changed the formulas for the colors being drawn. when it what
code: |
** := i + white
that is the same as
** := i
|
the white is not necessary. and you will still end up with the same color. now if you take what i put it will give your circle a different color and when your square goes on it's third time it will actually be the first color that the circle was. but they will never be the same.
that is if you don't want them the same. again it is your preference dmitrip. but my code up their is what you need pretty much. just give it a try. i think you might like it.
but if you want the best effect just take out all the cls and it will give the proper effect of drawing on top of each other. with out that annoying clearing. also i adjusted the positioning of the shaped so that is looks more presentable
Hope ya like it.
to dmitrip, I noticed you made a new topic on pretty much the same thing i gave you help on yesterday. It is ok to create new topics but if you already started one about your drawing problem. just post in your original drawing post. |
|
|
|
|
 |
ericfourfour
|
Posted: Thu Feb 15, 2007 11:46 pm Post subject: Re: help with loops and shape drawings please |
|
|
Why are you making this so complicated?
|
|
|
|
|
 |
romantic_programmer

|
Posted: Sat Feb 17, 2007 3:25 am Post subject: RE:help with loops and shape drawings please |
|
|
ericfourfour, i could have simple used your method but i i figure dmitrip would like to still use his own code. Since it is his own work. And yes he could use your method. but how will that help him learn with no explanation.
so what kind of example are you setting with no commenting hehe.
ya i know i didn't comment either *Starts to beat self with mouse while shouting bad person* |
|
|
|
|
 |
MysticVegeta

|
Posted: Mon Feb 19, 2007 1:40 am Post subject: Re: help with loops and shape drawings please |
|
|
oh lol, i thought he wanted to erase the previous drawing before he drew another one, my bad. sry for the confusion  |
|
|
|
|
 |
|
|