Compare commits

...

2 Commits

Author SHA1 Message Date
SimonezYT 4d9dd16398 Merge pull request 'Aggiunta della schermata iniziale' (#1) from schermata_iniziale into main
Reviewed-on: #1
2026-03-10 11:59:29 +01:00
Simone 638b50efb2 Aggiunta della schermata iniziale 2026-03-10 09:55:46 +01:00
5 changed files with 170 additions and 9 deletions
+1
View File
@@ -1,3 +1,4 @@
# green-gaming # green-gaming
Gioco per la Giornata della Terra Gioco per la Giornata della Terra
Nome: Pulisci il mondo
+22 -5
View File
@@ -7,15 +7,32 @@
</head> </head>
<body> <body>
<div id="start"> <div id="start">
<img src="./img/titolo.png" alt="titolo" /> <video autoplay muted loop id="bg-video">
<div class="container"> <source src="./video/background.mp4" type="video/mp4">
<div class="left">ISTRUZIONI</div> </video>
<div class="center">Clicca per giocare</div> <div class="overlay"></div>
<div class="right"></div> <div class="content">
<div class="top-section">
<img src="./img/titolo.png" alt="titolo" class="main-title" />
</div>
<div class="container bottom-section">
<div class="item left">
<div class="controls-box">
<h3>Controlli</h3>
<p><kbd>W</kbd><kbd>A</kbd><kbd>S</kbd><kbd>D</kbd> Movimento</p>
<p><kbd>Mouse</kbd> Camera</p>
</div>
</div>
<div class="item center">
<span class="pulse-text">Clicca per giocare</span>
</div>
<div class="item right"></div>
</div>
</div> </div>
</div> </div>
<div id="punti">Rifiuti: <span id="score">0</span></div> <div id="punti">Rifiuti: <span id="score">0</span></div>
<div id="tempo">Tempo: <span id="time">XX:XX</span></div> <div id="tempo">Tempo: <span id="time">XX:XX</span></div>
<div id="crosshair">+</div>
<script type="importmap"> <script type="importmap">
{ {
"imports": { "imports": {
+2
View File
@@ -1,3 +1,5 @@
Nome gioco: Pulisci il mondo
posizioni: 20 posizioni predefinite scelte random posizioni: 20 posizioni predefinite scelte random
tempo 1° fase: 1m tempo 1° fase: 1m
tempo 2° fase: 5s * punteggio tempo 2° fase: 5s * punteggio
+5 -1
View File
@@ -24,11 +24,15 @@ function lock() {
document.getElementById('start').style.display = 'none'; document.getElementById('start').style.display = 'none';
document.getElementById('punti').style.display = 'block'; document.getElementById('punti').style.display = 'block';
document.getElementById('tempo').style.display = 'block'; document.getElementById('tempo').style.display = 'block';
document.getElementById('crosshair').style.display = 'block';
} }
function unlock() { function unlock() {
document.getElementById('start').style.display = 'flex'; const startDiv = document.getElementById('start');
startDiv.style.display = 'flex'; // Forza il layout Flexbox
// Nascondi l'HUD
document.getElementById('punti').style.display = 'none'; document.getElementById('punti').style.display = 'none';
document.getElementById('tempo').style.display = 'none'; document.getElementById('tempo').style.display = 'none';
document.getElementById('crosshair').style.display = 'none';
} }
const controls = new PointerLockControls(camera, document.body); const controls = new PointerLockControls(camera, document.body);
document.getElementById('start').addEventListener('click', () => controls.lock()); document.getElementById('start').addEventListener('click', () => controls.lock());
+139 -2
View File
@@ -26,16 +26,153 @@ body {
pointer-events: none; pointer-events: none;
display: none; display: none;
} }
#punti, #tempo {
position: absolute;
top: var(--top);
color: white;
font-size: var(--text);
pointer-events: none;
display: none;
/* Aggiungi questa riga */
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
font-weight: bold;
}
/* Cursore */
#crosshair {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-size: 24px;
font-family: sans-serif;
pointer-events: none;
display: none; /* Sarà visualizzato solo durante il gioco */
z-index: 10;
}
/* Schermata iniziale del gioco */
#start { #start {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(0,0,0,0.5); overflow: hidden;
color: white; color: white;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
/* Queste 4 righe garantiscono la centratura totale */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 100; /* Assicurati che sia sopra al renderer di Three.js */
}
/* Video a tutto schermo */
#bg-video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
object-fit: cover; /* Riempie lo schermo senza deformare */
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.4);
z-index: 0;
pointer-events: none; /* Il click attraversa l'overlay e arriva a #start */
}
.content {
position: relative;
z-index: 1;
height: 100%;
width: 100%; /* Aggiunto */
display: flex;
flex-direction: column;
}
/* Divisione 50% Sopra */
.top-section {
flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer; }
.main-title {
max-width: 80%;
height: auto;
}
/* Divisione 50% Sotto */
.bottom-section {
flex: 1;
display: flex;
flex-direction: row;
width: 100%; /* Forza l'espansione orizzontale */
align-items: flex-start;
padding-top: 20px;
}
.item {
/* flex: 1 0 33%; significa: cresci, non restringerti, base 33% */
flex: 1 0 33.33%;
display: flex;
justify-content: center;
text-align: center;
}
/* Styling dei Controlli (KBD) */
.controls-box {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.controls-box h3 {
margin-bottom: 10px;
font-size: 1.2rem;
text-transform: uppercase;
}
.controls-box h3, .controls-box p, .pulse-text {
margin-top: 0;
}
kbd {
background-color: #eee;
border-radius: 3px;
border: 1px solid #b4b4b4;
box-shadow: 0 1px 1px rgba(0,0,0,0.2), 0 2px 0 0 rgba(255,255,255,0.7) inset;
color: #333;
display: inline-block;
font-size: 0.85em;
font-weight: 700;
line-height: 1;
padding: 2px 4px;
white-space: nowrap;
margin: 0 2px;
}
/* Animazione per "Clicca per giocare" */
.pulse-text {
font-size: 1.5rem;
text-transform: uppercase;
letter-spacing: 2px;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.4; }
100% { opacity: 1; }
} }