Spaces:
Running
Running
Update index.html
Browse files- index.html +47 -8
index.html
CHANGED
@@ -161,6 +161,11 @@
|
|
161 |
.item-text { color: #6af; font-style: italic; font-size: 0.9em; margin-bottom: 1em; border-left: 3px solid #369; padding-left: 8px; background-color: rgba(0, 100, 200, 0.1); padding: 5px;}
|
162 |
.stat-increase-text { color: #9f9; font-style: italic; font-size: 0.9em; margin-bottom: 1em; border-left: 3px solid #4a4; padding-left: 8px; background-color: rgba(0, 200, 0, 0.1); padding: 5px;}
|
163 |
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
</style>
|
166 |
</head>
|
@@ -168,16 +173,19 @@
|
|
168 |
<div id="game-container">
|
169 |
<div id="scene-container"></div>
|
170 |
<div id="ui-container">
|
171 |
-
<h2 id="story-title">
|
172 |
<div id="story-content">
|
173 |
-
<p>
|
|
|
|
|
|
|
174 |
</div>
|
175 |
-
<div id="stats-inventory-container">
|
176 |
<div id="stats-display"></div>
|
177 |
<div id="effects-display"></div>
|
178 |
<div id="inventory-display"></div>
|
179 |
</div>
|
180 |
-
<div id="choices-container">
|
181 |
<h3>What will you do?</h3>
|
182 |
<div id="choices"></div>
|
183 |
</div>
|
@@ -203,6 +211,10 @@
|
|
203 |
const statsElement = document.getElementById('stats-display');
|
204 |
const effectsElement = document.getElementById('effects-display');
|
205 |
const inventoryElement = document.getElementById('inventory-display');
|
|
|
|
|
|
|
|
|
206 |
|
207 |
let scene, camera, renderer, clock;
|
208 |
let currentAssemblyGroup = null;
|
@@ -1426,12 +1438,15 @@
|
|
1426 |
currentAssemblyGroup = null;
|
1427 |
}
|
1428 |
currentLights.forEach(light => {
|
1429 |
-
if (light !== scene.children.find(c => c.isAmbientLight)) {
|
1430 |
scene.remove(light);
|
1431 |
if (light.dispose) light.dispose();
|
1432 |
}
|
1433 |
});
|
1434 |
-
|
|
|
|
|
|
|
1435 |
|
1436 |
scene.fog = null;
|
1437 |
currentFog = null;
|
@@ -1722,6 +1737,30 @@
|
|
1722 |
|
1723 |
}
|
1724 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1725 |
document.addEventListener('DOMContentLoaded', () => {
|
1726 |
console.log("DOM Ready - Initializing Enhanced Adventure.");
|
1727 |
try {
|
@@ -1729,8 +1768,8 @@
|
|
1729 |
if (!scene || !camera || !renderer) {
|
1730 |
throw new Error("Three.js core component initialization failed.");
|
1731 |
}
|
1732 |
-
|
1733 |
-
|
1734 |
} catch (error) {
|
1735 |
console.error("Initialization failed:", error);
|
1736 |
storyTitleElement.textContent = "Error During Initialization";
|
|
|
161 |
.item-text { color: #6af; font-style: italic; font-size: 0.9em; margin-bottom: 1em; border-left: 3px solid #369; padding-left: 8px; background-color: rgba(0, 100, 200, 0.1); padding: 5px;}
|
162 |
.stat-increase-text { color: #9f9; font-style: italic; font-size: 0.9em; margin-bottom: 1em; border-left: 3px solid #4a4; padding-left: 8px; background-color: rgba(0, 200, 0, 0.1); padding: 5px;}
|
163 |
|
164 |
+
#start-game-container {
|
165 |
+
padding: 30px 0;
|
166 |
+
text-align: center;
|
167 |
+
}
|
168 |
+
|
169 |
|
170 |
</style>
|
171 |
</head>
|
|
|
173 |
<div id="game-container">
|
174 |
<div id="scene-container"></div>
|
175 |
<div id="ui-container">
|
176 |
+
<h2 id="story-title">Welcome, Adventurer</h2>
|
177 |
<div id="story-content">
|
178 |
+
<p>The world awaits your decisions.</p>
|
179 |
+
<div id="start-game-container">
|
180 |
+
<button id="start-button" class="choice-button" style="width: 80%; margin: 20px auto; text-align: center; padding: 15px;">Begin Your Adventure</button>
|
181 |
+
</div>
|
182 |
</div>
|
183 |
+
<div id="stats-inventory-container" style="display: none;">
|
184 |
<div id="stats-display"></div>
|
185 |
<div id="effects-display"></div>
|
186 |
<div id="inventory-display"></div>
|
187 |
</div>
|
188 |
+
<div id="choices-container" style="display: none;">
|
189 |
<h3>What will you do?</h3>
|
190 |
<div id="choices"></div>
|
191 |
</div>
|
|
|
211 |
const statsElement = document.getElementById('stats-display');
|
212 |
const effectsElement = document.getElementById('effects-display');
|
213 |
const inventoryElement = document.getElementById('inventory-display');
|
214 |
+
const startGameContainer = document.getElementById('start-game-container');
|
215 |
+
const statsInventoryContainer = document.getElementById('stats-inventory-container');
|
216 |
+
const choicesContainer = document.getElementById('choices-container');
|
217 |
+
|
218 |
|
219 |
let scene, camera, renderer, clock;
|
220 |
let currentAssemblyGroup = null;
|
|
|
1438 |
currentAssemblyGroup = null;
|
1439 |
}
|
1440 |
currentLights.forEach(light => {
|
1441 |
+
if (light && light !== scene.children.find(c => c && c.isAmbientLight)) {
|
1442 |
scene.remove(light);
|
1443 |
if (light.dispose) light.dispose();
|
1444 |
}
|
1445 |
});
|
1446 |
+
|
1447 |
+
const ambientLight = scene.children.find(c => c && c.isAmbientLight);
|
1448 |
+
currentLights = ambientLight ? [ambientLight] : [];
|
1449 |
+
|
1450 |
|
1451 |
scene.fog = null;
|
1452 |
currentFog = null;
|
|
|
1737 |
|
1738 |
}
|
1739 |
|
1740 |
+
function setupStartButton() {
|
1741 |
+
const startButton = document.getElementById('start-button');
|
1742 |
+
|
1743 |
+
if (startButton && startGameContainer) {
|
1744 |
+
statsInventoryContainer.style.display = 'none';
|
1745 |
+
choicesContainer.style.display = 'none';
|
1746 |
+
storyTitleElement.textContent = "Welcome";
|
1747 |
+
storyContentElement.innerHTML = "<p>Click 'Begin Your Adventure' to start.</p>" + startGameContainer.innerHTML;
|
1748 |
+
startGameContainer.style.display = 'block';
|
1749 |
+
|
1750 |
+
startButton.onclick = () => {
|
1751 |
+
console.log("Start button clicked.");
|
1752 |
+
startGameContainer.style.display = 'none';
|
1753 |
+
statsInventoryContainer.style.display = 'block';
|
1754 |
+
choicesContainer.style.display = 'block';
|
1755 |
+
startGame();
|
1756 |
+
};
|
1757 |
+
} else {
|
1758 |
+
console.error("Start button or container not found!");
|
1759 |
+
storyContentElement.innerHTML = "<p style='color:red;'>Error: Could not set up start button.</p>";
|
1760 |
+
}
|
1761 |
+
}
|
1762 |
+
|
1763 |
+
|
1764 |
document.addEventListener('DOMContentLoaded', () => {
|
1765 |
console.log("DOM Ready - Initializing Enhanced Adventure.");
|
1766 |
try {
|
|
|
1768 |
if (!scene || !camera || !renderer) {
|
1769 |
throw new Error("Three.js core component initialization failed.");
|
1770 |
}
|
1771 |
+
setupStartButton();
|
1772 |
+
console.log("Initialization complete. Ready to start.");
|
1773 |
} catch (error) {
|
1774 |
console.error("Initialization failed:", error);
|
1775 |
storyTitleElement.textContent = "Error During Initialization";
|