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

Username:   Password: 
 RegisterRegister   
 How can i make this animation smooth
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Woodbridge




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue May 20, 2003 9:01 am   Post subject: (No subject)

you set screen to graphics mode, you should have set it to offscreenonly instead
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
naoki




PostPosted: Tue May 20, 2003 4:59 pm   Post subject: (No subject)

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




PostPosted: Tue May 20, 2003 5:24 pm   Post subject: (No 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
Woodbridge




PostPosted: Wed May 21, 2003 8:27 pm   Post subject: (No 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
nate




PostPosted: Wed May 21, 2003 8:43 pm   Post subject: nope

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




PostPosted: Thu May 22, 2003 7:37 am   Post subject: (No 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
naoki




PostPosted: Thu May 22, 2003 4:04 pm   Post subject: (No 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
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: