
-----------------------------------
ohgeez_
Thu Apr 20, 2006 9:28 pm

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?

-----------------------------------
[Gandalf]
Thu Apr 20, 2006 9:49 pm

Re: Help me on Records and Forks please
-----------------------------------
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
Thu Apr 20, 2006 9:55 pm


-----------------------------------
if you insist on using getch() though, you could combine it with hasch


if hasch then
   getch(c)
else
   % there's nothing waiting to be read, don't pause for getch
end if

