Design: Achieve a C + + version of the classic tank war game.
Functional design:
1) To achieve the two-man battle function. Win: But destroy each other's tanks or blow up each other's headquarters first.
2) The battlefield consists of a lattice of 26*26, tanks for 2*2, the headquarters of the banner 2*2, bullets for 2*1, Stones and iron block: 1*1
Tanks and bullets move one cell at a time.
3) Tank event:
Generated: generated at the original location (that is, given the original coordinates)
Mobile/non-removable: Receives the move command, determines whether the 2*1 is a space, moves, or abandons the move.
Turn: Move when you receive a left or right turn command
Hit: When the bullets coincide, the tank is destroyed, the delay shows the explosion screen, and then disappears.
4) Bullet Event:
Generation: In front of the tank cannon Tube generation, first to the coordinates, first judge hit, hit then disappear, not hit then take the bullets in front of the next box to continue to judge (that is, moving).
Whether to hit: disappear when with borders, tanks, bullets, stones, iron blocks, and coincident.
Movement: The speed of the bullet moves, depending on the dwell time in the lattice, first set to stay 1/4 seconds after moving to the next grid.
Tank Wars Game Design (c + +)