Skip to content

Commit

Permalink
added the library with the motivational quote
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorstener committed May 1, 2024
1 parent 79892ad commit 35a8782
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Binary file added images/banner.webp
Binary file not shown.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<button id="button1">Go to store</button>
<button id="button2">Go to cave</button>
<button id="button3">Fight dragon</button>
<button id="button4">Help</button>
</div>
<div id="monsterStats">
<span class="stat">Monster Name: <strong><span id="monsterName"></span></strong></span>
Expand All @@ -32,9 +33,8 @@
are in the town square. Where do you want to go? Use the buttons above.
</div>
</div>
<script src="/script.js">

</script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="/script.js"></script>
</body>

</html>
13 changes: 10 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let inventory = ["stick"];
const button1 = document.querySelector("#button1");
const button2 = document.querySelector("#button2");
const button3 = document.querySelector("#button3");
const button4 = document.querySelector("#button4");
const text = document.querySelector("#text");
const xpText = document.querySelector("#xpText");
const healthText = document.querySelector("#healthText");
Expand Down Expand Up @@ -124,6 +125,7 @@ localStorage.setItem("Inventory", JSON.stringify(inventory));
button1.onclick = goStore;
button2.onclick = goCave;
button3.onclick = fightDragon;
button4.onclick = help;

// FUNCTIONS //

Expand Down Expand Up @@ -159,7 +161,6 @@ function goCave() {
update(locations[2]);
}

/*YA ESTA FUNCIONANDO BIEN CON EL LOCAL STORAGE CHEQUEADO*/
function buyHealth() {
if (parseInt(localStorage.getItem("Gold")) >= 10) {
let currentGold = parseInt(localStorage.getItem("Gold"));
Expand All @@ -175,7 +176,6 @@ function buyHealth() {
}
}

/*YA ESTA FUNCIONANDO BIEN CON EL LOCAL STORAGE CHEQUEADO*/
function buyWeapon() {
let currentWeaponIndex = parseInt(localStorage.getItem("Current Weapon"));
if (currentWeaponIndex < weapons.length - 1) {
Expand Down Expand Up @@ -205,7 +205,6 @@ function buyWeapon() {
}
}

/*YA ESTA FUNCIONANDO BIEN CON EL LOCAL STORAGE CHEQUEADO*/
function sellWeapon() {
let inventory = JSON.parse(localStorage.getItem("Inventory") || "[]");
if (inventory.length > 1) {
Expand Down Expand Up @@ -351,6 +350,14 @@ function pickEight() {

}

function help () {
Swal.fire({
imageUrl: "/images/banner.webp",
imageWidth: 2000,
imageAlt: "Motivational quote: 'Fight with honor, Fight with discipline, Fight with vengeance"
});
}

function pick(guess) {
let numbers = [];
while (numbers.length < 2) {
Expand Down

0 comments on commit 35a8782

Please sign in to comment.