(By making this tank game, I began to master the production methods of some mini-games, which are summarized as follows: 1. Learn the basic language of C language, understand basic algorithms and process control; 2. Learn to make basic graphics; please refer to the start of the graphics mode. This version of Bamboo sticks to the top of the post "Give me a point and I can draw the whole world". For the functions of basic graphics, you can refer to other programs. I will only mention a few basic functions here: 1) Rectangle: rectangle(intx, inty, intex, intey); where x is the abscissa of the starting point, y is the ordinate of the starting point, ex is the abscissa of the stopping point, and ey is the ordinate of the stopping point; 2) Circle: circle(intx, inty, intr); x, y is the coordinate of the center of the circle, r is the radius; 3) Set the background color: setbkcolor(intc); c is the color you want to set, for details, please refer to the "Function Viewer" posted on the top of this version of Bamboo; 3 After you master these, you can proceed Your first game attempt; 1) First of all, you need to understand your C language mastery, and the idea of ??the game is in line with the actual game design, you can slightly exceed your own level, but you need to clear up where the technical bottle stem is; 2) Look at other Find a way to manage or bypass bottlenecks; 3) Make a detailed process of the game (I take a tank as an example): (1) Cut the screen: that is, set the game range, and cut the screen with squares, So convenient. To locate your graphic orientation, I made a table function and put it there. In the include folder, you can directly put the code into the program; (2) draw static graphics: use your grid as the norm to make your game hero, mine is to make a tank, please refer to me for details in the original code. voidtank(intx, inty, intc) function, as well as cannonball function and blasting function; (3) Make your graphics move: A I edit the tank I control first: a Use keyboard control: The detailed behavior is to define you first The keys to be used, such as tanks initially. The defined lines #define, the values ??behind are one-to-one correspondence with the keys, such as: up0x4800down0x5000left0x4b00; right0x4d00esc0x011b, etc.; b According to the input keys, change the coordinates of the protagonist (tank), see the end of the main function of the original program; c The cycle makes the protagonist (tank) based on the coordinates; B makes the opponent's tank move: a just replace the keyboard control with random number control, I use the random() function to generate 4 random numbers, and replace the 4 buttons in sequence; b, c Same as above A; (4) Synchronous action: put all the tools in a big loop, change the coordinates one by one in each loop, and draw according to the new coordinates, here I want to focus on the importance of the keyhit() function, For detailed usage, please refer to the example of greedy snake in the attachment; at the end, your game should begin to take shape, and the future work is just how to improve him and decorate him, which should be done according to personal preference; since I am also a novice, Therefore, my summary is inevitably wrong, and please give pointers from experts.
20070610192300108\Login window\HZK16
ccase\C1.C
ccase\C10.C
ccase\C11.C
ccase\C12.C)