Home > Back-end >  Does greatly in text game as the main body to multiple small link should be how to do?
Does greatly in text game as the main body to multiple small link should be how to do?

Time:06-07

Does greatly
In word games as the main body, to link up and how to implement multiple small game? (snake demining maze, etc.)
When words in some case, for example, began to implement snake procedures, after the execution returns word game
Whether the snake game as a whole function, screen clearing executive function when a case?
Thank you greatly the patient answer ~ ~

CodePudding user response:

The independent snake game main function to change a name,

CodePudding user response:

Have a simple, inside the main loop of the game make decision into the judgment of the game (you can take the global variable control), then the game with its own main loop, stuck the main game of the main loop, and then wait for you to play enough change the variable a, exit the main loop of the game, son returned to the main game of the main loop

CodePudding user response:

refer to the second floor and 蘤 old crepe reply:
make a simple, inside the main loop of the game make a decision to enter the son of the game (you can get the global variable control), then the game with its own main loop, caught the main game of the main loop, and then wait for you to play enough change the variable a, exit the main loop of the game, son returned to the main game of the main loop

Of the main loop needs an exit game loop, is still just a variable

CodePudding user response:

reference 1st floor ooolinux response:
change my independent snake game the main function of a name,

I'm going to put every game writes in a source file, such as word games is a source file, the snake is a source file, and then into a project
In the words of one case of snake function called, excuse me how to operate, is the need to write the header file? Just started to learn C - trouble greatly

CodePudding user response:

reference 4 floor with 蘤 old crepe response:
Quote: refer to the second floor and 蘤 old crepe reply:

Have a simple, inside the main loop of the game make decision into the judgment of the game (you can take the global variable control), then the game with its own main loop, stuck the main game of the main loop, and then wait for you to play enough change the variable a, exit the main loop of the game, son returned to the main game of the main loop

The main loop of the sub game needs an exit loop judgment, is still just a variable

Because there are a few small games to their respective is a source file, with word games as the main body, a certain case CLS run other small game back words,,,
Just started to learn C, trouble greatly patience to grant instruction...

CodePudding user response:

Multiple file compiler: https://blog.csdn.net/walle2018/article/details/79765330

CodePudding user response:

The game as a function of the ordinary, multi-file project, don't have the exit out of function in the game, and with a return statement to return to the main loop,

CodePudding user response:

I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related