+ 2
I have made snake classic game in c++ but in it how to make the snake bite itself to over the game??
2 Antworten
+ 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
0
output