Skip to content

Commit

Permalink
criando constante de monstros
Browse files Browse the repository at this point in the history
  • Loading branch information
jmtannus committed Feb 29, 2024
1 parent ea29b39 commit 38662f6
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions Aprenda JavaScript-básico-criando-um-jogo-de-RPG/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,15 @@ const monsterStats = document.querySelector("#monsterStats");
const monsterName = document.querySelector("#monsterName");
const monsterHealthText = document.querySelector("#monsterHealth");
const weapons = [
{
name: "stick",
power: 5,
},
{
name: "dagger",
power: 30,
},
{
name: "claw hammer",
power: 50,
},
{
name: "sword",
power: 100,
},
{ name: "stick", power: 5 },
{ name: "dagger", power: 30 },
{ name: "claw hammer", power: 50 },
{ name: "sword", power: 100 },
];
const monsters = [
{ name: "slime", level: 2, health: 15 },
{ name: "fanged beast", level: 8, health: 60 },
{ name: "dragon", level: 20, health: 300},
];

//criando objetos ao meu array de locais e suas propriedades
Expand Down Expand Up @@ -122,6 +115,18 @@ function buyWeapon() {
}
}

function sellWeapon() {
if (inventory.length > 1) {
gold += 15;
goldText.innerText = gold;
let currentWeapon = inventory.shift();
text.innerText = "You sold a " + currentWeapon + ".";
text.innerText += " In your inventory you have: " + inventory;
} else {
text.innerText = "Don't sell your only weapon!";
}
}

function fightSlime() {}

function fightBeast() {}

0 comments on commit 38662f6

Please sign in to comment.