Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

DOS Snake

I'm trying to make a simple dos version of snake. I know how to do all the simple dos graphics, but I have a problem with controlling the snake. When I change directions, I have to press a key. The game is inside a loop, so if I need keyboard input, it stops the game until I press something. What code do I need to keep the snake moving, but also ready for user input? PLEASE HELP! I don't need the whole program, I got most of it. I just need to know how to do the moving part.

Comments

  • stoberstober Member Posts: 9,765 ✭✭✭
    : I'm trying to make a simple dos version of snake. I know how to do all the simple dos graphics, but I have a problem with controlling the snake. When I change directions, I have to press a key. The game is inside a loop, so if I need keyboard input, it stops the game until I press something. What code do I need to keep the snake moving, but also ready for user input? PLEASE HELP! I don't need the whole program, I got most of it. I just need to know how to do the moving part.
    :

    [blue]use a function that checks for keyboard input without blocking your program, such as kbhit(). If no keyboard input, then continue on with your program, otherwise go get the key like your program is doing now.[/blue]
Sign In or Register to comment.