+ 1
Snake is going reverse
Hi. I'm making snake game and snake can go reverse to it's tail. How to fix this? For example, snake is going up and user can make it going down. How to prevent this?
2 odpowiedzi
+ 11
You can add if statements like this:
if(next == 'up' && curr != 'down'){
curr = next
}
but it's hard to help without seeing your code
+ 2
thanks for your support, but one guy helped me with idea. I worked a little bit on his code and everything is working now