
-----------------------------------
capella
Wed May 27, 2009 8:50 am

doing more than one animations at the same time !!
-----------------------------------
What is it you are trying to achieve?



What is the problem you are having?



Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 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


-----------------------------------
apomb
Wed May 27, 2009 8:59 am

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 [url=http://www.compsci.ca/v2/viewtopic.php?t=14665]procedures.

-----------------------------------
Dusk Eagle
Wed May 27, 2009 5:32 pm

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?

for decreasing i: 180 .. 174
    drawfilloval (480,i,5,5,green)
    delay (1)
end for 


Since you are not using View.Update, all you are really doing is pausing the code for a few milliseconds, which is pretty useless.

-----------------------------------
tjmoore1993
Wed May 27, 2009 5:36 pm

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?
