console.readkey

c# console snake gets stuck on long key press

被刻印的时光 ゝ 提交于 2019-11-30 07:42:18
问题 I just started learning programming couple months ago and decided to do a console snake game. Everything works great expect for one thing. If my snake is going upwards and I press down arrow and keep it pressed , my snake just stops and stays stopped even awhile after I stop pressing the button. Same thing happens if my snake is going right and I press right arrow too long, I lose control for some time(but snake does not stop). It happens for every way(left,right,up,down). I tried to compare

c# console snake gets stuck on long key press

a 夏天 提交于 2019-11-29 05:20:55
I just started learning programming couple months ago and decided to do a console snake game. Everything works great expect for one thing. If my snake is going upwards and I press down arrow and keep it pressed , my snake just stops and stays stopped even awhile after I stop pressing the button. Same thing happens if my snake is going right and I press right arrow too long, I lose control for some time(but snake does not stop). It happens for every way(left,right,up,down). I tried to compare the cki to another ConsoleKeyInfo with slight delay between them, but it doesn't matter. If I keep the