Create a complete space shooter game packaged as a single self-contained HTML file that includes all HTML markup, CSS styling, and JavaScript game logic. The game must meet the following detailed requirements:
Core Game Structure
- Package all game assets, styling, and functionality within one HTML file for standalone execution
- Implement a modern, visually polished user interface with clear visual hierarchy and responsive design that works across standard screen sizes
- Use canvas or WebGL for smooth 60fps game rendering with modern visual effects for explosions, engine trails, and weapon fire
Player Mechanics
- Implement a player spaceship with a starting health pool that is visually displayed on the UI
- Grant the player 3 initial lives, with remaining lives clearly shown on the game screen
- Allow the player to take damage from enemy projectiles and enemy collisions, with proper damage calculation applied to the player’s health
- Add health pickup items (health potions) that spawn vertically from the top of the screen and move downward continuously
- Configure health potions to spawn with a 3% probability per second under normal conditions
- Pause health potion spawns for 30 seconds after the player collects any health potion, after which the 3% per second spawn probability resumes
- Ensure only one health potion exists on screen at any time to prevent excessive power-ups
Enemy System
- Include multiple distinct enemy types with unique movement patterns, health values, and firing behaviors to create varied gameplay challenges
- Use realistic, visually distinct spaceship designs for all enemy units to differentiate their threat levels
- Scale enemy spawn rates by 10% when advancing to each new stage, starting with the base spawn rate for Stage 1
- Implement horizontal-only movement for all boss entities to maintain consistent boss fight mechanics
- Create multiple unique boss characters, each equipped with entirely distinct attack patterns (such as spread fire, homing projectiles, laser barrages, and wave attacks)
- Trigger a boss fight at the end of each stage, requiring the player to defeat the boss to unlock progression
- Advance the game to Stage 2 after defeating the Stage 1 boss, with a 10% increase in enemy spawn rates
- Advance the game to Stage 3 after defeating the Stage 2 boss, with an additional 10% increase in enemy spawn rates for increased difficulty
UI Requirements
- Display the player’s current score as a persistent, easy-to-read element on the game screen, updating in real-time as points are earned
- Show the player’s current health as a visual bar or numeric value that updates immediately when damage is taken or health is restored
- Display remaining lives as icons or numeric text that update when the player loses a life
- Add stage number indicators to inform players which difficulty stage they are currently playing through
- Ensure all UI elements have high contrast against the space background to remain visible at all times
Gameplay Polish
- Implement proper collision detection for all projectiles, player ship, enemy ships, and collectible items
- Add sound effects for firing, explosions, health collection, and boss encounters to enhance immersion
- Include a game over screen that displays the final score and an option to restart the game
- Add a win condition for Stage 3 that triggers a victory screen after defeating the final boss
- Test all game mechanics to ensure smooth progression, correct spawn rates, and accurate damage calculation across all stages