|
42 | 42 | <a href="#pacman-game" class="pacman-link"><h1 id="pacman-game">Pacman Game</h1></a> |
43 | 43 | <canvas id="pacmanCanvas" width="896" height="992"></canvas> |
44 | 44 | <p>Use arrow keys to move Pacman. Collect all the whale icons while avoiding the monsters.</p> |
| 45 | +<div id="funFactContainer" style="display: none; margin: 15px auto; max-width: 600px; padding: 15px; background-color: #0066b8; color: white; border-radius: 5px; text-align: center; font-weight: bold;"></div> |
45 | 46 | <button id="restartButton" class="pacman-button">Restart Game</button> |
46 | 47 | <script> |
47 | 48 | // Larger Pacman game (dev container themed, fewer collectibles, bigger whales) |
|
306 | 307 | for (const monster of globalThis.monsterStates) { |
307 | 308 | if (monster.x === pacman.x && monster.y === pacman.y) { |
308 | 309 | lives--; |
| 310 | + |
| 311 | + // Show a dev container fun fact |
| 312 | + showRandomDevContainerFact(); |
| 313 | + |
309 | 314 | if (lives <= 0) { |
310 | 315 | gameOver = true; |
311 | 316 | } else { |
|
344 | 349 | ctx.textAlign = 'left'; // Reset text align |
345 | 350 | } |
346 | 351 |
|
| 352 | +// Define dev container fun facts |
| 353 | +const devContainerFacts = [ |
| 354 | + "Dev containers provide a consistent development environment for all team members!", |
| 355 | + "Dev containers can include pre-installed tools, runtimes, and dependencies!", |
| 356 | + "You can customize your dev container with VS Code extensions!", |
| 357 | + "Dev containers help eliminate 'it works on my machine' problems!", |
| 358 | + "Docker is the most common runtime used for dev containers!", |
| 359 | + "Dev containers can be used with GitHub Codespaces for cloud development!", |
| 360 | + "You can use devcontainer.json to define your development environment!", |
| 361 | + "Dev containers support port forwarding to access running services!", |
| 362 | + "Dev containers can be version-controlled alongside your code!", |
| 363 | + "You can mount your local filesystem into a dev container!", |
| 364 | + "Dev container features are reusable components for common tools!", |
| 365 | + "VS Code automatically detects dev containers in repositories!", |
| 366 | + "Dev containers can significantly reduce onboarding time for new developers!", |
| 367 | + "You can use multi-container setups with Docker Compose!", |
| 368 | + "Dev containers support GPU acceleration for ML development!" |
| 369 | +]; |
| 370 | + |
| 371 | +// Function to display a random dev container fun fact |
| 372 | +function showRandomDevContainerFact() { |
| 373 | + const factContainer = document.getElementById('funFactContainer'); |
| 374 | + const randomFact = devContainerFacts[Math.floor(Math.random() * devContainerFacts.length)]; |
| 375 | + factContainer.textContent = "Dev Container Fun Fact: " + randomFact; |
| 376 | + factContainer.style.display = 'block'; |
| 377 | + |
| 378 | + // Hide the fact after 5 seconds |
| 379 | + setTimeout(() => { |
| 380 | + factContainer.style.display = 'none'; |
| 381 | + }, 5000); |
| 382 | +} |
| 383 | + |
347 | 384 | // Reset game state |
348 | 385 | function resetGame() { |
349 | 386 | // Reset map (restore dots) |
|
378 | 415 | // Reset pacman |
379 | 416 | pacman = { x: 14, y: 17, dx: 0, dy: 0, nextDx: 0, nextDy: 0 }; |
380 | 417 |
|
| 418 | + // Hide fun fact container |
| 419 | + document.getElementById('funFactContainer').style.display = 'none'; |
| 420 | + |
381 | 421 | // Reset monsters to original positions |
382 | 422 | globalThis.monsterStates = monsters.map(m => ({...m, dx: 0, dy: 0})); |
383 | 423 |
|
|
0 commit comments