doing more than one animations at the same time !!
Author |
Message |
capella
|
Posted: Wed May 27, 2009 8:50 am Post subject: doing more than one animations at the same time !! |
|
|
What is it you are trying to achieve?
<create more than one animations at the same time>
What is the problem you are having?
<only one animation will run at a time>
Describe what you have tried to solve this problem
<tried puting a for statement inside another loop>
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing: |
<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% apple tree
drawfillbox (500, 50, 540, 200, brown)
drawfilloval (480, 200, 30, 30, green)
drawfilloval (510, 240, 30, 30, green)
drawfilloval (520, 190, 30, 30, green)
drawfilloval (560, 220, 30, 30, green)
drawfilloval (570, 190, 25, 25, green)
drawfilloval (500, 200, 5, 5, red)
drawfilloval (480, 180, 5, 5, red)
drawfilloval (475, 210, 5, 5, red)
drawfilloval (520, 230, 5, 5, red)
drawfilloval (520, 180, 5, 5, red)
drawfilloval (535, 205, 5, 5, red)
drawfilloval (555, 220, 5, 5, red)
drawfilloval (560, 195, 5, 5, red)
for decreasing p: 180 .. 30
setscreen ("offscreenonly")
drawfilloval (480, p, 5, 5, 70)
for decreasing i: 180 .. 174
drawfilloval (480,i, 5, 5, green)
delay (1)
end for
drawfilloval (480, p- 10, 5, 5, red)
View.Update
delay (1)
end for
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drawfilloval (180, 300, 45, 20, white)
drawfilloval (210, 300, 40, 30, white)
for b: 400.. 500
drawfilloval (b, 300, 55, 30, white)
delay (25)
View.Update
drawfilloval (b, 300, 55, 30, 53)
delay (25)
end for
drawfilloval (500, 300, 55, 30, white)
>
|
Please specify what version of Turing you are using
<Turing 4.0.5.> |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
apomb
![](http://compsci.ca/v3/uploads/user_avatars/6489609347028a0f2422f.png)
|
Posted: Wed May 27, 2009 8:59 am Post subject: RE:doing more than one animations at the same time !! |
|
|
Turing looks at each line of code in sequence, therefore, whatever is near the top of the program will run before code is below it, unless you use procedures. |
|
|
|
|
![](images/spacer.gif) |
Dusk Eagle
![](http://compsci.ca/v3/uploads/user_avatars/78727197549dd7290a342c.png)
|
Posted: Wed May 27, 2009 5:32 pm Post subject: Re: doing more than one animations at the same time !! |
|
|
When using any kind of loop (including for loops), the computer will run through the for loop a set number of times before moving on to any code below. To accomplish what you want, you must stick all your drawing code within one for loop, and do a bit of math to get them aligned properly (This would be much easier if you started your for loops from 0 rather than the weird numbers you're starting with. Then , you can draw something like this: drawfilloval (480, p + 100, 5, 5, 70) .)
BTW: what do you hope these lines of code accomplish?
Since you are not using View.Update, all you are really doing is pausing the code for a few milliseconds, which is pretty useless. |
|
|
|
|
![](images/spacer.gif) |
tjmoore1993
![](http://compsci.ca/v3/uploads/user_avatars/8387623034a0f8ae34317b.gif)
|
Posted: Wed May 27, 2009 5:36 pm Post subject: RE:doing more than one animations at the same time !! |
|
|
I see that your using offscreenonly, how ever the suggestions given above work fine if done properly. Why not load everything to the back buffer (offscreenonly) then just View.Update to have it all presented at the same time.
Just some idea? |
|
|
|
|
![](images/spacer.gif) |
|
|