Computer Science Canada

simple animation, please help soon! :)

Author:  marz [ Fri Apr 25, 2003 10:04 pm ]
Post subject:  simple animation, please help soon! :)

HI, I'm a very beginner in turing, and I have just finised learning all about loops and if statements, and am now begining to go on to animation...except i am really lost. I just need to know the code for how to get a simple box from the top right of the screen to the top left...nothing fancy. I know that I have to use the Draw.FillBox command, and then i have to redraw it, but i dont understand how still. Please help, thanks! Surprised

Author:  Homer_simpson [ Fri Apr 25, 2003 10:08 pm ]
Post subject: 

code:
for x : 0 .. 640
    Draw.FillBox (x, 380, x + 20, 400, 9)
    delay (10)
    cls
end for

Author:  Homer_simpson [ Fri Apr 25, 2003 10:12 pm ]
Post subject: 

as u can see that one flickers very much....
now here' what u have to learn to do animations
View.Set("offscreenonly") and View.Update

when u put View.Set("offscreenonly") at the beggining of your program the screen doesn't change untill u type View.Update and it helps u reduce the flicker.
and this is your program would look like with View.Set("offscreenonly")


code:
View.Set ("offscreenonly")
for x : 0 .. 640
    Draw.FillBox (x, 380, x + 20, 400, 9) %draws the box
    View.Update %puts it on the screen
    delay (10) %delys the program for a very very short while so you will have the chance to see the box
    cls %cleans the screen for a new box to be drawn
end for

Author:  Blade [ Fri Apr 25, 2003 10:30 pm ]
Post subject: 

hey dude, don't forget that's only with turing 4.x <-- my school doesnt have that crap, we too cheap... so if you are only using 3.1.1, like my school, draw over it in the colour of your background, to reduce flicker

code:
for x : 0 .. 640
    Draw.FillBox (x, 380, x + 20, 400, 9)
    delay (10)
    Draw.FillBox(x,380,x + 20,400,white)
end for


: