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

Username:   Password: 
 RegisterRegister   
 Help me on Records and Forks please
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ohgeez_




PostPosted: Thu Apr 20, 2006 9:28 pm   Post subject: Help me on Records and Forks please

I've heard that forks should be avoided at all costs in acception to music but if i don't use forks, then how do I make two objects move at the same time?

I know that using both objects in the same loop would make the move at the same time but what if one of the object moving is based on an input from the user? Say i use 'getch' , the computer will always wait for the input before continuing on in the loop. This stops my other object from moving.

I heard some people say that it's possible to do it with records, is it possible? If so how?
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Thu Apr 20, 2006 9:49 pm   Post subject: Re: Help me on Records and Forks please

ohgeez_ wrote:
Say i use 'getch' , the computer will always wait for the input before continuing on in the loop. This stops my other object from moving.

No, it shouldn't prevent your loop from continuing if there is no key input. Both Input.KeyDown() and getch() work nearly the same, and we have a few tutorials on each:
http://www.compsci.ca/v2/viewtopic.php?t=114
http://www.compsci.ca/v2/viewtopic.php?t=3275
http://www.compsci.ca/v2/viewtopic.php?t=3270

And on records, in case you're interested. They are a very useful tool in Turing programming:
http://www.compsci.ca/v2/viewtopic.php?t=2325

For any extra help, consult the Turing Walkthrough.
Tony




PostPosted: Thu Apr 20, 2006 9:55 pm   Post subject: (No subject)

if you insist on using getch() though, you could combine it with hasch

code:

if hasch then
   getch(c)
else
   % there's nothing waiting to be read, don't pause for getch
end if
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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: