Briju's Droid Defence Game
-
Introduction The Defence Game is a 2D browser-based game developed using HTML, CSS, and JavaScript. The primary goal is to defend a base against waves of enemies while managing the player’s health and attacking adversaries. The game combines action and strategy, providing an engaging and dynamic experience.
-
Game Features The game allows players to control a character that can move using arrow keys and shoot bullets by clicking within the game canvas. Enemies spawn periodically, aiming to attack both the player and the base. The base and player have health bars (base_life and life), which decrease upon taking damage. A leaderboard tracks and displays the top scores to add a competitive edge.
-
Game Design The visuals are rendered on a canvas element, featuring smooth animations, gradient backgrounds, and health indicators. Players interact with the game through buttons for starting gameplay and toggling the leaderboard. Additionally, sound effects enhance the experience by playing during key actions like scoring or defeating enemies.
-
Leaderboard The leaderboard system uses localStorage to save and display the top 10 scores dynamically. It motivates players to improve their performance and provides a visual summary of the best gameplay sessions.
-
Core Components The game integrates three main components: HTML: Sets up the structure, including the canvas for gameplay and buttons for interactions. CSS: Provides styling for the game canvas, buttons, and the leaderboard for a clean, responsive design. JavaScript: Handles game logic, including player movement, shooting, enemy spawning, collision detection, scoring, and leaderboard updates.
-
Gameplay Logic The game begins when the player clicks the "Start Game" button. Enemies spawn periodically and move toward the base, challenging the player to shoot them down while avoiding damage. If the player's health (life) or the base's health (base_life) reaches zero, the game ends, displaying the final score.
-
Enhancements (Future Scope) Future improvements could include additional enemy types, difficulty levels, power-ups, new weapons, and multiplayer options, enhancing replayability and player engagement.