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

Username:   Password: 
 RegisterRegister   
 Movement Is "Glitchy"
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Rasta Fella




PostPosted: Sun Jan 15, 2006 11:18 am   Post subject: Movement Is "Glitchy"

The source code below is part of the program I am making. Seems to me when I run the program the 'dot' seems to flash. Its a problem, because the commands states to redraw the dot every some odd milliseconds. Is there a way that the flashy stuff can be fixed...because I don't want a problem in the future to occur. Or is it just my computer?? I already looked through alot of the programs....and I think the command View.Update can help???

Code Below:

code:
    var x, y : int                                               
    x := 20                                                                                   
    y := 60                                                                                       
    var chars : array char of boolean                                                         

   
drawfillbox(0,0,560,350,black)   
   
loop
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        if y <= 348 then
            y := y + 1
        end if
    end if
    if chars (KEY_RIGHT_ARROW) then
        if x <= 559 then
            x := x + 1
        end if
    end if
    if chars (KEY_LEFT_ARROW) then
        if x >= 1 then
            x := x - 1
        end if
    end if
    if chars (KEY_DOWN_ARROW) then
        if y >= 45 then
            y := y - 1
        end if
    end if

    drawfilloval (x, y, 1, 1, white)
    delay (5)
    drawfilloval (x, y, 1, 1, black)
end loop
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sun Jan 15, 2006 11:24 am   Post subject: (No subject)

View.Update will indeed help.

Stick this at the top of your program:
code:

View.Set ("offscreenonly")


Then, after you've drawn your dot, do a View.Update.
Rasta Fella




PostPosted: Sun Jan 15, 2006 5:16 pm   Post subject: (No subject)

Thanks Crevantes, It works now...

P.S. I like your new avatar, better then the pirate I think...
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  [ 3 Posts ]
Jump to:   


Style:  
Search: