![]() ![]() L = 0, U = 0, D = 0, //Left = false UP = false Down = falseīreak //We break it,end of the case.Identic with other cases. If (L = 0) //So if a player has clicked 'd' ,then.1:We check if snake is not //going left,because how can she turn right,if she's going left?Teleporting?. cases below,nothing special ,you should understand that easily //,but let me give a simple explanation of first case: Key = _getch() //Now this click is key switch( key ) Keep generating new coordinates of pineapple until that place is empty ![]() Bonus apple - every 8 normal apples eaten ,so we need to check - generate an apple or a bonus apple If(time = 0) //If you were too slow ,you lose a dollar and a new apple is generated If(map = char(5)) //If apple is bonus ,then start decreasing time to get it! EHM FORGET COLOR,not sure how to say I know: Stop using color SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), choosecolor) //FUNCTION OF COLOR SetConsoleCursorPosition(hOut, Position) void Start() //Start -_- friend void clearscreen() //It's actually not like system("cls"),but works almost same friend void sp() //Choose color function friend void s() //Forget choose color choice Void Graphics () //Drawing game void GameLogic() //Does it need comment? void KEYBOARD () //Checking for input void Pineapple() //Generating new apple int GameOver () //Game over ?. Z = 1 //So first apple generation will not be bugged. X = 1000 //Position of snake at the beggining Tail = 1 //Actually it will not have a tail until it eats first apple Std::vector past //Special vector for deleting old parts public: x - snake head position // z = for random number(pineapple generation) // y = tail coordinates time = time tail = snakelenght - 1 char *map //Map of game bool L,R,D,U,A //L = LEFT R = RIGHT D = DOWN U = UP A = JUST A BOOL #include #include #include //By Foxefde #include #include class Snake ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |