if snake is moving in right direction and we click left it starts to move in left direction. How to overcome that and the logic for this operation in up and down direction as well.
The movement of snake
@ganesh.btb142000
You just need to check if input is opposite to direction of movement. In that case you can just ignore input.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.