Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions paperfoldstudio/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const prestigeButton = document.getElementById('prestige-button');
const saveButton = document.getElementById('save-button');
const loadButton = document.getElementById('load-button');
const clearSaveButton = document.getElementById('clear-save-button');
const progressBar = document.getElementById('progress-bar');

let foldCount = 0;
let foldsPerClick = 1;
Expand Down Expand Up @@ -44,13 +45,37 @@ function foldsPerSecond() {
return assistantLevel * baseFoldsPerSecond * (1 + prestigeCount * prestigeBonus);
}

function spawnConfetti() {
const confetti = document.createElement('div');
confetti.className = 'confetti';
const size = Math.random() * 6 + 4;
confetti.style.backgroundColor = `hsl(${Math.random() * 360},100%,60%)`;
confetti.style.width = `${size}px`;
confetti.style.height = `${size}px`;
const rect = foldButton.getBoundingClientRect();
confetti.style.left = `${rect.left + rect.width / 2}px`;
confetti.style.top = `${rect.top}px`;
document.body.appendChild(confetti);
setTimeout(() => confetti.remove(), 1000);
}

function updateDisplay() {
foldDisplay.textContent = `Folds: ${Math.floor(foldCount)}`;
rateDisplay.textContent = `Folds/s: ${foldsPerSecond().toFixed(1)}`;
assistantInfo.textContent = `Level: ${assistantLevel} (${foldsPerSecond().toFixed(1)}/s) - Cost: ${assistantCost()}`;
skillPointsEl.textContent = skillPoints;
prestigeInfo.textContent = `Prestige count: ${prestigeCount}`;

const next = origamiSets.find(set => !set.completed);
if (next) {
const percent = Math.min((foldCount / next.cost) * 100, 100);
progressBar.style.width = percent + '%';
progressBar.textContent = `${Math.floor(percent)}% to ${next.name}`;
} else {
progressBar.style.width = '100%';
progressBar.textContent = 'All sets completed!';
}

// Update sets
setList.innerHTML = '';
origamiSets.forEach(set => {
Expand Down Expand Up @@ -99,6 +124,9 @@ function checkSets() {
if (!set.completed && foldCount >= set.cost) {
set.completed = true;
skillPoints += 1;
for (let i = 0; i < 10; i++) {
spawnConfetti();
}
}
});
}
Expand All @@ -122,6 +150,9 @@ function prestige() {
origamiSets.forEach(set => set.completed = false);
skills.forEach(skill => skill.purchased = false);
updateDisplay();
for (let i = 0; i < 20; i++) {
spawnConfetti();
}
}

function resetGame() {
Expand Down Expand Up @@ -181,6 +212,9 @@ function loadGame() {
// Event wiring
foldButton.addEventListener('click', () => {
addFold(foldsPerClick);
for (let i = 0; i < 5; i++) {
spawnConfetti();
}
});

hireAssistantButton.addEventListener('click', hireAssistant);
Expand Down
4 changes: 4 additions & 0 deletions paperfoldstudio/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
<head>
<meta charset="UTF-8">
<title>Paperfold Studio Web</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="game-container">
<h1>Paperfold Studio</h1>
<div id="fold-display">Folds: 0</div>
<div id="fold-progress"><div id="progress-bar"></div></div>
<div id="rate-display">Folds/s: 0</div>
<button id="fold-button">Fold!</button>

Expand Down
81 changes: 75 additions & 6 deletions paperfoldstudio/style.css
Original file line number Diff line number Diff line change
@@ -1,26 +1,82 @@
:root {
--primary: #ff5d8f;
--secondary: #5dc7ff;
}

body {
font-family: Arial, sans-serif;
font-family: 'Roboto', sans-serif;
text-align: center;
margin-top: 50px;
background: radial-gradient(circle at top, #222, #111);
color: #fafafa;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
}

#game-container {
position: relative;
display: inline-block;
padding: 20px;
border: 2px solid #333;
border-radius: 8px;
padding: 20px 40px;
border-radius: 10px;
background: rgba(0, 0, 0, 0.6);
box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
}

h1 {
font-family: 'Press Start 2P', cursive;
font-size: 32px;
margin-bottom: 20px;
color: var(--primary);
text-shadow: 0 0 10px var(--secondary);
}

#fold-display {
font-size: 24px;
margin: 20px;
}

#fold-progress {
background: #444;
border-radius: 4px;
height: 20px;
margin: 0 20px 10px;
overflow: hidden;
}

#progress-bar {
height: 100%;
width: 0;
background: linear-gradient(90deg, var(--primary), var(--secondary));
color: #000;
line-height: 20px;
font-size: 12px;
text-align: center;
transition: width 0.3s ease;
}

button {
font-family: inherit;
font-size: 18px;
padding: 10px 20px;
margin: 5px;
cursor: pointer;
border: none;
color: #fff;
background: linear-gradient(90deg, var(--primary), var(--secondary));
border-radius: 6px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
transition: transform 0.1s ease, box-shadow 0.2s ease;
}

button:hover {
background-color: #eee;
transform: scale(1.05);
box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
}

button:active {
transform: scale(0.95);
}

ul {
Expand All @@ -41,3 +97,16 @@ li {
color: #555;
margin-top: 5px;
}

.confetti {
position: absolute;
width: 8px;
height: 8px;
pointer-events: none;
animation: confetti-fall 1s linear forwards;
}

@keyframes confetti-fall {
0% { opacity: 1; transform: translateY(0) rotate(0deg); }
100% { opacity: 0; transform: translateY(200px) rotate(720deg); }
}