Computer Science Canada

need some help here >.<

Author:  lucky8 [ Sun Mar 01, 2009 10:14 pm ]
Post subject:  need some help here >.<

for this assignment i got, i made my background in turing and i made my thing to move around with loop, my problem is how to move my thing with clear screen without reprinting my background? it look weird when it prints background everytime, kinda flashy.

Author:  Tony [ Sun Mar 01, 2009 10:31 pm ]
Post subject:  RE:need some help here >.<

look into View.Update

Author:  A.J [ Sun Mar 01, 2009 10:32 pm ]
Post subject:  Re: need some help here >.<

to avoid the 'flashiness', try looking up View.Update in the Turing Walkthrough

EDIT : Sorry Tony...looks like you posted right before I did...

Author:  rdrake [ Sun Mar 01, 2009 10:32 pm ]
Post subject:  RE:need some help here >.<

You can't draw multiple layers. What you want to do is draw the entire screen before displaying it. Check out View.Set and View.Update.

EDIT: Holy hell, beaten twice.

Author:  Euphoracle [ Sun Mar 01, 2009 10:57 pm ]
Post subject:  RE:need some help here >.<

There's no way to do this. What you want to do is use "offscreenonly", draw to the backbuffer, and call View.Update when you're done drawing everything for the current frame. Example:

Turing:
setscreen ("offscreenonly")

const baseshift := 150
var shift := baseshift

proc DrawBackground
    drawfillbox (0, 0, maxx, maxy, blue)
end DrawBackground
proc DrawObject (xshift, yshift : int)
    var x := (maxx div 2) + xshift
    var y := (maxy div 2) + yshift
    var r := 50
    drawfilloval (x, y, r, r, red)
end DrawObject

var speed := 1
var deg := 0
var speed2 := 5
var deg2 := 0
var xs, ys : int

loop
    deg2 += speed2
    shift := round(cosd(deg2) * baseshift)
    deg += speed
    xs := round (cosd (deg) * shift)
    ys := round (sind (deg) * shift)
    DrawBackground
    DrawObject(xs, ys)
    View.Update ()
    Time.DelaySinceLast(20)
end loop


Look 'mah, no flickering!


: