Question: can you help me please with this game. How can I generate a random value as key. thanks Most games start with a concept and

 can you help me please with this game. How can I

generate a random value as key. thanks Most games start with a

concept and a mechanic (a way of playing the game ). You

do not want to start coding until you know exactly what kind

can you help me please with this game. How can I generate a random value as key. thanks

Most games start with a concept and a mechanic (a way of playing the game ). You do not want to start coding until you know exactly what kind of game you want to make. Games are too expensive and too complicated to just guess what you are doing. Our game is going to work as follows: A Dragoon character is created and we keep track of two pieces of information: o Health (Dragoon starts the game with 25 health points - HP) o Potions (Dragoon starts the game with 2 points to use, each potion regenerates SHP to the Dragoon ) We do not have a fancy graphics interface, so we are going to use the console to draw a grid to represent a bunch of squares through which the Dragoon can jump. rrent Ceiling squares ( 3 11 Each of these squares is covered with a blanket so the Dragoon does not know what is behind it. The squares can be of one of these: O A wall of spikes: Depending on the number of spikes, the Dragoon can take either 1 or 10 points damage. (If the health of the Dragoon drops below O it is game over) 0 A potion: The Dragoon picks up a potion jumping through this square and lands safely. 0 A key: The Dragoon finds a key that lets the Dragoon get out of the training room. (The player wins) TECHNICAL DESCRIPTION Now that I have described to you in general terms how the game is supposed to work, now it is time to start connecting it to the actual coding. Given the amount of time we have to do this game, I will give you some idea of the general elements you need and some basic structures, the rest you will have to implement In order to keep track of the player we are going to create a struct to keep track of the health a the Dragoon and the number of potions available: Let Dracor At health; in potions; Each of the cells the Dragoon is jumping through is going to be handled by another struct: astruct Celting_3a boel tested boud is _potions Loe 15_key: Int damage; The attributes of Ceiling_Square are described like this: tested: It is a bool variable that is true if the Dragoon has jumped through it, false otherwise is_potion: if this square contains a potion, this variable is true, false otherwise. is_key: if this square containts a key, this variable is true, false otherwise. damage: random value between 1 and 10 both ends included) to represent how many spikes are in this square and the damage the Dragoon will take. Now in our main() function we can define the following helpful variables (they are not global): Cesting Square some_board [MAX_BOARD] [MAX_BOARD) : There is one constant here that you can define globally COT Int NUK BOARD 5; order to make this project work you are going to need to code some functions to help you t Notice the type of the function and the name and parameters. Initialize the Board: Inttelle voard 185 **AX FOARD) This function sets every square in the grid to default values: everything false or 0. Display Square: boac display_squarcs (cilinz_square square_bsora LJ [MAX_BOARD) This function displays the current state of the ceiling squares. Squares that have not been tested yet will be displayed with a # symbol in it. Tested squares will either display a number for the number of spikes or a P for potion Current Celling squares: I # [ 7 Once the player explores some of the square you should see something like this: Current Ceiling Squares: [P] [#] [#] [4] # ] [ #] [#] [#] [#] #] [2] [ #] [ #] ][ ] [ #] [#] 1] [2] [#] [ ] Add Key to squares: void add_kcy(Ceiling_Square square_board [MAX_BOARD)) This function finds a random square and sets its value to have a key. Add Potions to squares: void add potions (ciling Square amare Doard [MAX_BOARD ) This function finds 5 random squares and sets the square to have a potion. The maximum number of potions is stored in another constant ne game starts by creating a clean grid of squares, assigns one to be the key, assigns 5 ave potions and then the game is a loop that you run until the player has found the sq ith the key, or the health of the Dragoon has dropped below 0. Each time the player m ecision which is either jump ( you ask for a square to jump to ) or heal ( you restore sor ealth and reduce the number of potions available). Covide feedback to the player in the form of player info, the current state of the square hether the option picked resulted in damage, potion, or health, for example: Drinking a potion hat do you want to do? 1 - Jump 2 - Use Potion Enter choice. 2 you drink a potion >>>> playar Info: Pleyor online 10 Playet Potloris: 1 Jumping through a square with a potion what do you want to do? 1 Jump 2 Use Potion Enter choice: 1 Enter X and Y value for where you want to jump to: B 1 You are sate, you found a potion Hitting a wall What do you want to do 1 JED 2. Use Pation Enter choice! Ertur X and Y value for where you want to jump to: 2 rou nit a wall and you took daage of 2 Finding the key at do you want to do? 1 Jump 2 - Use Potion Entor choica: 11 Enter X and Y value for where you want to jump to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!