-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Hamza <[email protected]> Co-authored-by: isaacfonner <[email protected]> Co-authored-by: Gabrielle Sutherland <[email protected]>
- Loading branch information
1 parent
43802e5
commit 748645f
Showing
8 changed files
with
548 additions
and
217 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
let gameRunning = false; | ||
let inputSelected = false; | ||
let event = 1; | ||
let lastGameInput = 0; | ||
|
||
let quests = []; | ||
const inventory = [["candy", 2]]; | ||
|
||
const people = { | ||
"oldmanneighbor": { | ||
name: "Old Man Henry" | ||
}, | ||
"femaleneighbor": { | ||
name: "House Resident" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
const inventoryImages = { | ||
"key": "https://ih1.redbubble.net/image.2797266866.2128/bg,f8f8f8-flat,750x,075,f-pad,750x1000,f8f8f8.jpg", | ||
"wallet": "https://www.megavoxels.com/wp-content/uploads/2024/07/Pixel-Art-Flower-5.webp", | ||
"lamp": "https://www.megavoxels.com/wp-content/uploads/2024/07/how-to-make-pixel-art-candy-6.webp", | ||
"plate": "https://img.freepik.com/premium-vector/apple-pixel-art-style_553915-88.jpg", | ||
"silverware": "https://img.freepik.com/premium-vector/apple-pixel-art-style_553915-88.jpg", | ||
"soap": "https://cloud-lhqcn70mv-hack-club-bot.vercel.app/0image.png", | ||
"chair:": "https://cloud-lhqcn70mv-hack-club-bot.vercel.app/0image.png", | ||
"candy": "" | ||
} | ||
|
||
function isInInventory(item) { | ||
for (let i = 0; i < inventory.length; i++) { | ||
if (inventory[i][0] === item) { | ||
return true; | ||
} | ||
} | ||
} | ||
|
||
function addItemToInventory(item, amount) { | ||
if (amount === undefined) amount = 1; | ||
for (let i = 0; i < inventory.length; i++) { | ||
if (inventory[i][0] === item) { | ||
inventory[i][1] += amount; | ||
return; | ||
} | ||
} | ||
inventory.push([item, 1]); | ||
newLine(`Added ${amount} ${item}(s)`); | ||
} | ||
|
||
function removeItemFromInventory(item, amount) { | ||
if (amount === undefined) amount = 1; | ||
for (let i = 0; i < inventory.length; i++) { | ||
if (inventory[i][0] === item) { | ||
inventory[i][1] -= amount; | ||
if (inventory[i][1] === 0) { | ||
inventory.splice(i, 1); | ||
} | ||
newLine(`Removed ${amount} ${item}(s)`); | ||
return; | ||
} | ||
} | ||
newLine("You don't a(n) " + item); | ||
} | ||
|
||
function showInventoryDialog() { | ||
let inventoryBox = document.createElement("div"); | ||
newLine(`Inventory: ${(inventory.length === 0) ? " is empty" : ""}`); | ||
|
||
|
||
inventoryBox.classList.add("dialog"); | ||
|
||
for (let i = 0; i < inventory.length; i++) { | ||
let container = document.createElement("div"); | ||
container.style.display = "inline-block"; | ||
let itemInfo = document.createElement("p"); | ||
|
||
let item = inventory[i][0]; | ||
let quantity = inventory[i][1]; | ||
let itemImage = document.createElement("img"); | ||
|
||
itemInfo.innerText = `${item} x${quantity}`; | ||
|
||
itemImage.src = inventoryImages[item]; | ||
itemImage.style.width = "100px"; | ||
itemImage.style.height = "100px"; | ||
itemImage.style.margin = "10px"; | ||
container.append(itemInfo) | ||
container.append(itemImage); | ||
inventoryBox.append(container); | ||
} | ||
|
||
document.querySelector(".lines").append(inventoryBox); | ||
return inventoryBox; | ||
} |
Oops, something went wrong.