Include version info in game
All checks were successful
Build and Publish Docker Image / Build and Validate (pull_request) Successful in 8s
Build and Publish Docker Image / Publish to Registry (pull_request) Has been skipped

This commit is contained in:
Juan Sebastián Montoya 2025-11-26 11:04:17 -05:00
parent aeb14921bc
commit f3b11c7d63
4 changed files with 114 additions and 8 deletions

View file

@ -72,10 +72,25 @@
text-align: center;
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
#version {
position: absolute;
top: 20px;
right: 20px;
color: rgba(255, 255, 255, 0.7);
font-size: 14px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
z-index: 100;
font-family: 'Courier New', monospace;
}
@media (max-width: 768px) {
#instructions {
font-size: 14px;
}
#version {
font-size: 12px;
top: 10px;
right: 10px;
}
}
</style>
</head>
@ -85,6 +100,8 @@
<div>Health: <span id="health">100</span></div>
</div>
<div id="version">v<span id="versionNumber">-</span></div>
<div id="gameOver">
<h1>Game Over!</h1>
<p>Final Score: <span id="finalScore">0</span></p>
@ -97,6 +114,27 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script>
// Load and display version information
(function() {
fetch('/version.json')
.then(response => {
if (response.ok) {
return response.json();
}
throw new Error('Version file not found');
})
.then(data => {
const versionElement = document.getElementById('versionNumber');
if (versionElement && data.version) {
versionElement.textContent = data.version;
}
})
.catch(error => {
// Silently fail if version.json doesn't exist (e.g., in development)
console.debug('Version information not available:', error.message);
});
})();
// Base GameObject class
class GameObject {
constructor(scene, groundSize) {