From d8f4604e69d2c5a40479311f962b56c7566f54e0 Mon Sep 17 00:00:00 2001 From: Juan Sebastian Montoya Date: Wed, 26 Nov 2025 18:47:41 -0500 Subject: [PATCH] Release/First full release version (#18) - Added start menu, pause menu, and game over screens to enhance user experience. - Introduced UISystem to manage UI state transitions and visibility. - Updated Game class to handle game state (menu, playing, paused, game over). - Integrated CameraSystem for improved camera control and screen shake effects. - Added new components for collision handling, scoring, and game state management. - Refactored sound management to separate background music handling. This update significantly improves the game's UI and overall gameplay flow. Reviewed-on: https://git.jusemon.com/jusemon/threejs-test/pulls/18 Co-authored-by: Juan Sebastian Montoya Co-committed-by: Juan Sebastian Montoya --- index.html | 64 +- src/components/Camera.js | 11 + src/components/CollisionEvent.js | 21 + src/components/GameOver.js | 11 + src/components/Score.js | 23 + src/ecs/World.js | 11 +- src/game/Game.js | 831 ++++++++++--------------- src/systems/BackgroundMusicManager.js | 285 +++++++++ src/systems/CameraSystem.js | 109 ++++ src/systems/CollisionResponseSystem.js | 323 ++++++++++ src/systems/CollisionSystem.js | 40 +- src/systems/GameStateSystem.js | 151 +++++ src/systems/SoundSystem.js | 242 +------ src/systems/UISystem.js | 96 +++ 14 files changed, 1467 insertions(+), 751 deletions(-) create mode 100644 src/components/Camera.js create mode 100644 src/components/CollisionEvent.js create mode 100644 src/components/GameOver.js create mode 100644 src/components/Score.js create mode 100644 src/systems/BackgroundMusicManager.js create mode 100644 src/systems/CameraSystem.js create mode 100644 src/systems/CollisionResponseSystem.js create mode 100644 src/systems/GameStateSystem.js create mode 100644 src/systems/UISystem.js diff --git a/index.html b/index.html index 63d7c83..6af2d9b 100644 --- a/index.html +++ b/index.html @@ -41,29 +41,43 @@ 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.2); } } - #gameOver { + #startMenu, #pauseMenu, #gameOver { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); - background: rgba(0,0,0,0.8); - padding: 40px; + background: rgba(0,0,0,0.9); + padding: 50px; border-radius: 20px; text-align: center; color: white; - display: none; z-index: 200; + min-width: 400px; + box-shadow: 0 10px 40px rgba(0,0,0,0.5); } - #gameOver h1 { + #startMenu { + display: block; + } + #pauseMenu, #gameOver { + display: none; + } + #startMenu h1, #pauseMenu h1, #gameOver h1 { font-size: 48px; margin-bottom: 20px; + color: #4CAF50; + } + #pauseMenu h1 { + color: #FFA500; + } + #gameOver h1 { color: #ff6b6b; } - #gameOver p { - font-size: 24px; + #startMenu p, #pauseMenu p, #gameOver p { + font-size: 20px; margin-bottom: 30px; + line-height: 1.6; } - #restartBtn { + #startMenu button, #pauseMenu button, #restartBtn { background: #4CAF50; border: none; color: white; @@ -72,11 +86,18 @@ border-radius: 10px; cursor: pointer; transition: all 0.3s; + margin: 10px; } - #restartBtn:hover { + #startMenu button:hover, #pauseMenu button:hover, #restartBtn:hover { background: #45a049; transform: scale(1.1); } + #pauseMenu button.resumeBtn { + background: #2196F3; + } + #pauseMenu button.resumeBtn:hover { + background: #1976D2; + } #instructions { position: absolute; bottom: 20px; @@ -153,7 +174,7 @@ -
+ +
+

🎮 Coin Collector

+

Collect coins, avoid obstacles, and survive as long as you can!

+

+ Controls:
+ WASD or Arrow Keys to move
+ Touch and drag (mobile)
+ ESC or P to pause +

+ +
+ +
+

⏸️ Paused

+

Game is paused

+ + +
+

Game Over!

@@ -178,9 +218,9 @@
-
+