The second course is designed to

 

The second course is designed to spring 2019 test report

 

First, the  pilot project name

Combat aircraft     

 

Second, the  pilot project Functional Description

  1. By controlling the movement of aircraft w, a, s, d and spaces and firing bullets

2. achieve multiple enemy attacks

3. The intern aircraft fired shotgun functions

 

Third, the  project introduces modular structure

1, startup () function: the initialization data for

        Define position_x and position_y to determine the position of the aircraft

        

 

Determining the position of the enemy, the enemy since the emergence of a new enemy is hit, the use rand () function determines a random number in the screen to determine the position of the aircraft and

       

 

2, show () function: a display screen

By controlling the two-dimensional array of canvas [High] [Width] corresponding element of the output space, aircraft, bulletsand the enemy !

 

 

 

3, updateWithoutInput () function:  user-independent input update

          For controlling the bullet hit the enemy, a new aircraft, bullet disappear, impact, and scores count

4, updateWithInput () function  and a user input related updates

          Be implemented depending on the user's input show () output function, i.e., the output of the control space and enemy aircraft bullets

5, blanking feature: the screen flashes a serious need to clear the screen

gotoxy () function: the position of the cursor

HideCursor () function: to hide the cursor

 

Upon initialization call gotoxy () function to move the cursor to the home position,

The display screen when the call HideCursor () function to hide the cursor

 

 

Fourth,  implement the interface display

 

V.  code hosting links

https://gitee.com/xu23/xuhao

Six  experimental summary

Questions: 1. did not understand the role of rand () function 

      2. The  array as well as an array of complex

Solve : 1.  because the enemy will disappear after being hit, so there will be a new enemy, but can not define all of the enemy position, this time need rand () function, rand ()% A, is in the 0- ( a random number between a-1) to determine the position of the new enemy.

 

Thoughts: a program by a fraction of a fraction constituted so write a program first needs to have a general framework, understand the requirements of the program, the role, the functions implemented needs, and step begins implementation code.

       This game and the last game is actually about the same aircraft, on the basis of the original plus a number of enemy aircraft and mobile, and the function of transmitting shotgun, so two-dimensional array is used to control the application of the array can be more easily record complex data, implement complex display, and control logic judgment, but need more understanding, we need to consolidate a solid knowledge base.

 

Guess you like

Origin www.cnblogs.com/xu23/p/10986555.html