Your are to create a text base game to try and hit a target in two dimensional plane (X,Y)...solved

Your are to create a text base game to try and hit a target in two dimensional plane (X,Y)...solved

Your are to create a text base game to try and hit a target in two dimensional plane (X,Y) using a cannon ball.

The program will randomly create 5 targets (5 sets of X,Y) and display the set on screen. These are the coordinates of the targets such that:  500 < X < 5000 (meter) and 500< Y < 5000(meter)

Player will have 3 chances to hit any of the 5 square targets which is 10 X 10 meters by entering the initial velocity and initial angle. The coordinate of the target is at the center of the target.

If the player hits a target, the program will display the name and the number of tries and message indicating that the player won and the time it took to hit the target (time of flight for the hit try), and the target number with beeps for indication that a target was hit. If the player did not hit any target in 3 tries, the program will display the initial angles and the initial velocities that were needed to hit each target and list them on the screen.

Regardless of win or lose, the program must record the target numbers and their coordinates in a file with the players name (a name from namepass.txt, below), for example leia.txt

The game can be played only if the user has the correct name and correct ID. The list of names and ID’s are given in a text file called namepass.txt, such as below

leia 12345

darth 23456

r2d2 34567

solo 45678

jabba 56789

yoda 67890

Game Requirements:

You must use array of structures for targets for each game. The members of the structure are: target # (1 to 5), coordinate of the target (X,Y)

The player must enter a correct name and ID (in namepass.txt file)to get access to the game

Player can choose to play again

Use random number generator for X and Y of each target

Must save the result in a file

More requirements, In addition to our standards:

1.       The main function must do very little other than calling other functions and passing parameters to those functions.

2.       Your program should be modularly designed with functions designed to do one task and one task well.

3.       Use of pointers for arrays are encouraged

4.       Do not use global variables. Pass data back and forth via parameters or as return values.

5.       Make your functions as general as possible so that they can be called more than once if needed.

6.       Document your main function as well as every function you write.

7.       Use defined constants for ALL constants (if any) in your program.

 
Powered by