B
B
barbedman2016-07-28 03:13:26
C++ / C#
barbedman, 2016-07-28 03:13:26

How to implement a change in direction of movement in an infinite loop?

Good evening everyone. Now I am writing a snake in the console for the sake of interest. The question arose - how can you implement rotations of the snake on pressing, so that the rest of the time it moves in the cycle in the selected direction?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Pogrebnyak, 2016-07-28
@barbedman

1) if (_khhit())
keystroke;
motion;
2) threads

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question