Computer Science Canada

How can i make this animation smooth

Author:  Woodbridge [ Tue May 20, 2003 8:50 am ]
Post subject:  How can i make this animation smooth

I made this program but the animation is not smooth. Can somone tell me what i did wrong.
setscreen ("graphics:450;400")
var pointx, pointy,level,difficult,psize,bouncer,bouncex,bouncey : int := 0
var centy,centx:int:=20
var mover : string (1)
var col,score,endscore: int := 0
var font1:int
process paddle
Draw.FillBox (5, col, 10, col + 100, blue)
loop
if hasch then
getch (mover)
if mover = chr (200) then
col := col + 10
elsif mover = chr (208) then
col := col - 10
end if
end if
Draw.FillBox (5, col, 10, col + 100, blue)
View.Update


delay(20)
cls

end loop
end paddle

fork paddle

thanks

Author:  Tony [ Tue May 20, 2003 9:01 am ]
Post subject: 

you set screen to graphics mode, you should have set it to offscreenonly instead

Author:  naoki [ Tue May 20, 2003 4:59 pm ]
Post subject: 

can anyone give me an example where input.keydown is less beneficial than hasch/getch structure?

Author:  Catalyst [ Tue May 20, 2003 5:24 pm ]
Post subject: 

it never is
getch/hasch will always be slower and less useful
the only case that might be presented is less lines
like it would be pointless to use keydown for this:
loop
exit when hasch
end loop

Author:  Woodbridge [ Wed May 21, 2003 8:27 pm ]
Post subject: 

I need the getch/hasch because the program is supposed to be a paddle for the game pong. i have to make it for a school project. but if you have any suggestions on how to do it better please share them.
thanks

Author:  nate [ Wed May 21, 2003 8:43 pm ]
Post subject:  nope

no u don't i made a pong game w. input.keydown easily!

Author:  Blade [ Thu May 22, 2003 7:37 am ]
Post subject: 

yeah. i prefer to use input.keydown too becuase it runs a hella lot faster. but it's only supported in turing 4.x not 3.x same with View.Set("offscreenonly")/View.Update

Author:  naoki [ Thu May 22, 2003 4:04 pm ]
Post subject: 

i think getch also has the unfortunate feature of needing a buffer when you press keys down too quickly

like when moving a circle, you can flood and make it move after you've stopped pressing on a key


: