Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve below question and Create the file mentioned in the above. Question 2: Video Game Creation (10 points) Question 2a: Create a playGame function

Please solve below question and Create the file mentioned in the above.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Question 2: Video Game Creation (10 points) Question 2a: Create a playGame function (8 points) playGame(protag: Character, antag: Character) takes in two parameters: - protag: Character - antag: Character Print both protag and antag. Then stimulate their match. The match will go as follows. - At the start of every turn, the function prints out the health and energy of both you your opponent - The function then prints all of your moves and asks you to choose a move - If you select a move that you don't have enough energy for, the function will print "you don't have enough energy" for that move then skip your turn - If you type a move that does not exists, the function prompts you again to choose a move. It keeps doing this until you choose a valid move - Once a valid move is selected, it subtracts the required energy away from your Character's cur_energy, then subtracts the antag's health from your move's damage attribute. If the antag's health reaches 0 , print "> wins!!!" and end the function - The function then does the same for the antagonist. However, their move is randomly generated from their list of available moves. If they chose a move that they do not have enough energy for, print they do not have enough energy for that move and skip their turn. If they defeated the protagonist, then print they won and end the function - Once the turn is over, recover 5% of their max energy to both the protag and antag - Keep starting a new turn until one side reaches 0 health. An example of the game running is shown below PRINTING THE PROTAGONIST'S INFO name: Professor Laidoff description: A professor by day, streamer by night, and laid off 24/7. health: 100 energy: 100 cur_health: 100 cur_energy: 100 moves: Google Boycott, Layoff Slash, Boring Lecture, Raid!!! PRINTING THE ANTAGONIST'S INFO name: Pikachu description: An electric mouse health: 68 energy: 200 cur_health: 50 cur_energy: 200 moves: Quick Attack, Iron Tail, Thunder, Volt Tackle You have 100 health left and 108 energy left The enemy has 68 health left and 288 energy left The 1ist of available moves are as follows: Google Boycott: DMG=25 NRG=10 Layoff Slash: DNG=10 NRG =23 Boring Lecture: DMG=5NRG=5 Raid!!!: DMG=50 NRG =75 Choose your move: Raid! Not a valid move. Please choose again Choose your move: Raid!I! Pikachu survives with 16 health! Pikachu uses Thunder! You have 25 health left and 36.0 energy left The enemy has 18 health left and 118.8 energy left The list of available moves are as follows: Google Boycott: DMG=25 NRG =18 Layoff Slash: ONG=40 NRG =23 Boring Lecture: DMG=5 NRG =5 Raid ! ! !: DMG =50 NRG =75 Choose your move: Raid!!! Not enough energy to use this move Pikachu survives with 10 health! Pikachu uses Thunder! Pikachu wins!!! Question 2b: Create a playGame2(protag: Character, antag_list: list of Characters) function (1 point) Same as playGame except you provide a list of antagonists and the function randomly selects one to fight. This function is easy to complete if you use the playGame function. Question 2c: Create a playGame3(protag: Character, antag_list: list of Characters) function (1 point) Same as playGame2 except you keep fighting a random enemy from the antagonists lists until the protag runs out of health (health doesn't reset for every new enemy you fight). At the end, print how many enemies the protag was able to defeat before they inevitably lost. This function is also relatively easy to complete if you use the playGame function. Question 3 (Bonus): Add your own updates to the game (Can earn up to 2 points here) Create a new file A2Bonus.py and copy and paste your code from A2.py. Now, add your own additions to the game. Depending on how much and how creative the stuff you add is you may get 0.5,1,1.5, or 2 bonus points. This is up to the discretion of the graders. Here are some ideas on what you can add: - Add an accuracy instance attribute to the Class move - Add an item Class and give characters an item bag for them to use - Add status effects. Certain moves will give or have a chance of giving a certain status effect to the enemy - Add a new method playGame4 which lets you control 2 protagonist against 2 enemies. You have to chose which enemy you are targeting whenever you select a move. - Add an ability attribute to the Character Class. Different abilities can do different things - And many more

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

What magazine and ads did you choose to examine?

Answered: 1 week ago