Computer Science Canada drawing two ovals at the same time |
Author: | ddndd [ Sat Jan 09, 2010 10:18 pm ] |
Post subject: | drawing two ovals at the same time |
hi im trying to make 2 moving ovals, so far i created them and they are moving but the problem is that they are flashing too much, cuz i used a delay and drew them again in white code : var x,y,xx,yy:int x := maxx div 2 xx := maxx div 2 + 30 y := 100 loop y += 1 drawfilloval (x,y,10,10,black) delay (10) drawfilloval (x,y,10,10,white) drawfilloval (xx,y,10,10,black) delay (10) drawfilloval (xx,y,10,10,white) end loop i use turing 4.1 any ideas ?? |
Author: | TheGuardian001 [ Sat Jan 09, 2010 10:36 pm ] | ||||
Post subject: | Re: drawing two ovals at the same time | ||||
This is where View.Update and offscreenonly comes in handy. It basically combines all of the drawing you do into a single drawing, which is only shown on screen when View.Update is called.
Another problem you may run into is that you don't appear to be drawing in the correct order. In your program the flow is:
You may wish to consider drawing both ovals one after another without clearing, then clearing them both together, as this will also help the problem. A note about View.Update: You should only ever be calling this once inside of a loop. The whole point of using View.Update is to reduce flickering by drawing an entire scene in one motion. If you call it more than once in a single loop, you are defeating the purpose of using it in the first place. |
Author: | ddndd [ Sun Jan 10, 2010 11:05 am ] |
Post subject: | Re: drawing two ovals at the same time |
ohh so that is what view. update is for... thnx |