Question
Using Notepad++ create a new file called the_god_among_us_40.js -Do not use Html- 1. Implement the following functions: a. displayIntroduction: This function should take no arguments
Using Notepad++ create a new file called the_god_among_us_40.js
-Do not use Html-
1. Implement the following functions:
a. displayIntroduction: This function should take no arguments and display the introduction to your game.
b. getLeader: This function should prompt the user for their name and return it.
c. displayMenu: This function should display the menu.
d. doDamage: In Episode 2, you added options to your story that caused the player to lose lives. We're going to introduce the concept of player health. When the game starts, the player health should be 100. Rather than take an entire life, we want to do damage to the players health and take a life if their health falls below 100. This function should take the players current health as an argument, calculate the new health and return it to the caller. You can choose the amount of damage that is done. d. displayStats: This function displays the current player statistics.
3. Refactor your code to use the newly created functions.
4. Implement a module named inventory that will be responsible for managing the players inventory. The module should hold the array for the inventory and implement the following functions: a. displayInventory: Displays the current inventory
b. addToInventory: Adds an item to the inventory.
Apply the same rules to adding items as we did last week. Import your new module into the lost_fortune_40 program and replace the existing code with calls to the new module.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started