Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
Co-authored-by: Hamza <[email protected]>
Co-authored-by: isaacfonner <[email protected]>
Co-authored-by: Gabrielle Sutherland <[email protected]>
  • Loading branch information
4 people committed Nov 24, 2024
1 parent 43802e5 commit 748645f
Show file tree
Hide file tree
Showing 8 changed files with 548 additions and 217 deletions.
Binary file added assets/img/femaleneighbor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 10 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="icon" href="/assets/img/favicon.svg" />
</head>
<body style="width: 100vw; height: 100vh; overflow: hidden">
<h1 style="width: 100vw; text-align: center; font-size: 7vw">
<h1 style="width: 100vw; height: 10vh; text-align: center; font-size: 7vw">
Sleepwalker
</h1>

Expand All @@ -27,9 +27,10 @@ <h1 style="width: 100vw; text-align: center; font-size: 7vw">
alt="Hack Club"
/></a>
<div class="dev-profile-icon">
<a href="https://github.com/gesutherland" target="_blank"
><img class="pfp" src="/assets/img/gesutherland.jpg" alt="GitHub" />
<a href="https://github.com/isaacfonner" target="_blank"
><img class="pfp" src="/assets/img/isaacfonner.png" alt="GitHub" />
</a>

</div>
<div class="dev-profile-icon">
<a href="https://github.com/MichaByte" target="_blank"
Expand All @@ -42,8 +43,8 @@ <h1 style="width: 100vw; text-align: center; font-size: 7vw">
</a>
</div>
<div class="dev-profile-icon">
<a href="https://github.com/isaacfonner" target="_blank"
><img class="pfp" src="/assets/img/isaacfonner.png" alt="GitHub" />
<a href="https://github.com/gesutherland" target="_blank"
><img class="pfp" src="/assets/img/gesutherland.jpg" alt="GitHub" />
</a>
</div>
<div class="counterspell-logo">
Expand All @@ -56,5 +57,9 @@ <h1 style="width: 100vw; text-align: center; font-size: 7vw">
</div>
</div>
</body>
<script src="scripts/data.js"></script>
<script src="scripts/inventory.js"></script>
<script src="scripts/quests.js"></script>
<script src="scripts/shell.js"></script>
<script src="scripts/main.js"></script>
</html>
16 changes: 16 additions & 0 deletions scripts/data.js
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"
}
}
76 changes: 76 additions & 0 deletions scripts/inventory.js
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;
}
Loading

0 comments on commit 748645f

Please sign in to comment.