How do I eliminate flickering for "for loops"?
Author |
Message |
Vomirak
|
Posted: Sat Nov 05, 2011 12:18 pm Post subject: How do I eliminate flickering for "for loops"? |
|
|
So this assignment im working on is due monday, but I have a problem with getting View.Update to work properly. I've played around with View.Update and i can't get it to work how I want.
I have an object that has 7 layers of shapes/code on it, and whenever i try to make him move in a random direction, the object just flickers, this is what I'm doing to make him move,
for x : 0..200
draw blah blah blah %%%original shape%%%
delay (5)
draw blah blah blah %%%eraser that follows original shape%%%
end for
What am i doing wrong?
Description: |
it's based on the video game Portal |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
Turing Assignment.t |
Filesize: |
7.66 KB |
Downloaded: |
72 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Sat Nov 05, 2011 1:05 pm Post subject: RE:How do I eliminate flickering for "for loops"? |
|
|
This is what your code should look like
code: |
for x:0..200
draw blah blah blah
View.Update
delay (five)
erase stuff
end for
|
The general order of operations is draw stuff, view.update, delay, erase stuff.
|
|
|
|
|
![](images/spacer.gif) |
Aange10
![](http://compsci.ca/v3/uploads/user_avatars/19166165534f400d42de502.png)
|
Posted: Sat Nov 05, 2011 9:01 pm Post subject: RE:How do I eliminate flickering for "for loops"? |
|
|
Here's an example, aswell
|
|
|
|
|
![](images/spacer.gif) |
Beastinonyou
![](http://compsci.ca/v3/uploads/user_avatars/10820786614fe1f6d9ccbda.png)
|
Posted: Sun Nov 06, 2011 7:05 am Post subject: Re: RE:How do I eliminate flickering for "for loops"? |
|
|
Aange10 @ Sat Nov 05, 2011 9:01 pm wrote:
I bet this is the line of code he's missing from his program. Without this, View.Update does nothing.
|
|
|
|
|
![](images/spacer.gif) |
Velocity
![](http://compsci.ca/v3/uploads/user_avatars/1809397984eb9e2888e99b.jpg)
|
Posted: Tue Nov 08, 2011 8:34 pm Post subject: RE:How do I eliminate flickering for "for loops"? |
|
|
You can add View.Set ("offscreenonly")
^^^
at the beginning of your loop
------------------------------------------------
and ...
------------------------------------------------
View.UpdateArea (0, 0, maxx, maxy)
^^^
at the end of your loop
|
|
|
|
|
![](images/spacer.gif) |
|
|