Tell us what’s happening:
It is telling me to : “set health
to equal health
minus the monster’s level. Remember you can get this from the monsters[fighting].level
property.” I did this, (although obviously i’m wrong.) what am I doing wrong? I added health -= monsters[fighting].level
which i thought would do it, but its not working.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function attack() {
text.innerText = "The " + monsters[fighting].name + " attacks.";
text.innerText += " You attack it with your " + weapons. [currentWeaponIndex].name + ".";
health -= monsters[fighting].level;
}
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 122