help with shape animation please!!!
Author |
Message |
dmitrip
|
Posted: Wed Feb 14, 2007 1:03 pm Post subject: help with shape animation please!!! |
|
|
hello
i am new to turing , and currently learning it in high school.
now i have a little problem
i need to make a program that Draws a square and then a circle on the same spot 10 times so that it appears that each shape is being drawn on top of the last.
i been trying things for over an hour now, if anybody can tell me how i can do that i would really appreciate it.
thankss |
|
|
|
|
|
Sponsor Sponsor
|
|
|
romantic_programmer
|
Posted: Wed Feb 14, 2007 4:45 pm Post subject: Re: help with shape animation please!!! |
|
|
dmitrip, Of course i could do it for you. but how will you learn. plus CompSci isn't meant for for others to do your homework/classwork but for you you learn how to do it. so i will give you some tips.
P.s. i know teachers like to call this animation but i just call it drawing a circle on a square. and a square on a circle.
code: |
%% ok so we need to draw a square. simple enough?
drawfillbox (x1, y1, x2, y2, *Put a color here*)
&& now we need a circle?
drawfilloval (x1,y1, x2, y2, *Put a color here*)
|
Ok are you still with me dmitrip. these are just examples of the drawfill procedures that will be used.
Note:
x1= Your X location on the screen
y1= Your Y location on the screen
x2= Your width
y2= Your height
*I just thought you might like you know what those values mean.*
Now that you have your drawfill procedures, try make them look how the teacher wants them to look, by changing the (x1,y1,x2,y2) positioning. try different combinations to learn these procedures.
Now you can add delays, if you want to
(a delay statement is used to cause the program to pause for a given time. The time duration is in milliseconds.)
and example would be like this.
code: |
drawfillbox (x1, y1, x2, y2, *Put a color here*)
delay(100)
drawfilloval (x1,y1, x2, y2, *Put a color here*)
|
now you will see your box drawn then your circle will be drawn after the delay. congratulations on making it this far. Now as i am trying to think. Their is two ways to do this. But i believe your teacher is teaching you guys For statements. so lets again look at how a For statement is structured.
code: |
for i : 0 ..10
put i
end for
|
this will will show you an output from 0 to 10. so now lets see if we can figure out how to make this For statement work with your drawfill procedures.
Here is what you need to do:
Draw your drawfill procedures correctly.
insert some delays so you can see what's happening.
Lastly implement a for statement.
I know your teacher would love your assignment if you used that way to do it but if you really want to be lazy and get a really low *failing mark* you can always just copy and paste your code with out using for statements.
code: |
%%note this way is really inefficient and you will be spending alot more time programming it and will learn nothing from it.
drawfillbox (x1, y1, x2, y2, *Put a color here*)
delay(100)
drawfilloval (x1,y1, x2, y2, *Put a color here*)
delay(100)
drawfillbox (x1, y1, x2, y2, *Put a color here*)
delay(100)
drawfilloval (x1,y1, x2, y2, *Put a color here*)
delay(100)
drawfillbox (x1, y1, x2, y2, *Put a color here*)
delay(100)
drawfilloval (x1,y1, x2, y2, *Put a color here*)
delay(100)
drawfillbox (x1, y1, x2, y2, *Put a color here*)
delay(100)
drawfilloval (x1,y1, x2, y2, *Put a color here*)
delay(100)
drawfillbox (x1, y1, x2, y2, *Put a color here*)
delay(100)
drawfilloval (x1,y1, x2, y2, *Put a color here*)
%% that is the lazy mans way out. see all that useless code... well i don't suggest using this way because again it is improper and you teacher will give you a low mark compared to using a "for" statement.
|
I hope these examples help. if you have anymore questions just ask. |
|
|
|
|
|
dmitrip
|
Posted: Wed Feb 14, 2007 7:00 pm Post subject: Re: help with shape animation please!!! |
|
|
thank you very much romantic_programmer for taking the time and teaching me how to do this, i actually know how to do it now thanks alot! |
|
|
|
|
|
romantic_programmer
|
Posted: Wed Feb 14, 2007 7:41 pm Post subject: Re: help with shape animation please!!! |
|
|
no problem, always glad to help out a someone struggling with turing. If you ever need help on something look in the tutorial section and you might be able to find out some stuff you didn't know. and if it doesn't help you then ask questions.
good luck on your class.
romantic_programmer |
|
|
|
|
|
|
|