Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How do I eliminate flickering for "for loops"?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Vomirak




PostPosted: 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?



Turing Assignment.t
 Description:
it's based on the video game Portal

Download
 Filename:  Turing Assignment.t
 Filesize:  7.66 KB
 Downloaded:  72 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: 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.
Aange10




PostPosted: Sat Nov 05, 2011 9:01 pm   Post subject: RE:How do I eliminate flickering for "for loops"?

Here's an example, aswell

Turing:

View.Set ("offscreenonly")
for i : 1 .. 5
    cls
    drawfillbox (10, 0, 40, 40, (11 + i))
    View.Update
    delay (1000)
end for

Beastinonyou




PostPosted: 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:

Turing:

View.Set ("offscreenonly")


I bet this is the line of code he's missing from his program. Without this, View.Update does nothing.
Velocity




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: