I am making a pong game, I got everything, but the user is padding, I have a while (true) loop I am using it in which all methods are used. How can I go pedal with WADD? I want to keep going while waiting for user input I tried to use the console Readie () but it freezes the program
While I am a sports library (though I have no terminal
The main issue is that the The main issue is that the console can be useful.
console can be useful. Until ReadKey blocks (or "freeze") no key is available for reading; Use to see if a key is currently available:
while (true) {// clear all the keys in the queue; There can be multiple (hence "time") while (console's available) {// will not block because the key available to read is present. handle it. Var key = console Read (true); HandleKey (key); } // processing other .. process gaming (); // .. and about 100% CPU usage to ensure the yield / sleep. Thread.Sleep (0); }
No comments:
Post a Comment