I have made snake classic game in c++ but in it how to make the snake bite itself to over the game?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I have made snake classic game in c++ but in it how to make the snake bite itself to over the game??

30th Nov 2016, 12:13 PM
Aniket Prasad
Aniket Prasad - avatar
2 Answers
+ 4
Presuming that is was not a Console Application game or windows form application if (//snake bites itself) { //Code to stop the game //Code to write down a message to the user that they string(or var if you are using some .API package, etc) a = //take input from user if they want to quit/retry, you can use button if you want. if ( a == no) { //Code to exit the game } else { //Code to restart the game } else { //Code for the snake not biting itself, aka game continues. } You should know what code to use depending on what type of application/project you are using
30th Nov 2016, 12:21 PM
Wen Qin
Wen Qin - avatar
0
output
7th Jan 2018, 6:20 AM
Jaffar hanifa