NEW: Code has been refactored for better maintainability!
The game code is now split into two main files:
config.js- All game configuration and settings (EASY TO MODIFY)script_fixed.js- Main game logic and functionality
Experience the classic Space Invaders gameplay directly in your browser - no downloads required!
The new config.js file makes it super easy to customize the game:
// Want more lives? Change this:
const PLAYER_CONFIG = {
startingLives: 5, // Default: 3
};
// Want easier game? Modify this:
const DIFFICULTY_CONFIG = {
easy: {
enemySpeedMultiplier: 0.5, // Slower enemies
playerLives: 10, // More lives
},
};
// Want different colors? Update this:
const EFFECTS_CONFIG = {
colors: {
player: "#ff0000", // Red player ship
enemy: "#00ff00", // Green enemies
},
};- Player Lives: Edit
PLAYER_CONFIG.startingLives - Enemy Speed: Modify
INVADER_CONFIG.initialSpeed - Power-up Frequency: Change
POWERUP_CONFIG.spawnChance - Game Colors: Update
EFFECTS_CONFIG.colors - Audio Volume: Adjust
AUDIO_CONFIG.masterVolume - Canvas Size: Modify
CANVAS_CONFIG.width/height
A classic Space Invaders game built with HTML5, CSS3, and JavaScript. Defend Earth from alien invasion in this retro-style arcade game!
The game features an elegant main menu with:
- Start Mission button to begin the game
- Quick Play option for immediate action
- Navigation tabs for Main, Settings, Controls, and About
- Real-time display of Score, Lives, and Level
- Retro space-themed design with animated starfield background
Active gameplay showing:
- Player spaceship at the bottom (blue ship)
- Enemy invaders descending from the top
- Bullet projectiles flying across the screen
- Boss enemy with health bar (30/30)
- Real-time score tracking and game statistics
- Mouse control indicator in the UI
- Classic Space Invaders gameplay - Shoot alien invaders before they reach Earth
- Progressive difficulty - Enemies become faster and more numerous as levels advance
- Boss battles - Face powerful boss enemies with health bars
- Multiple lives system - Start with 3 lives, lose one when hit by enemies
- Score system - Earn points for destroying enemies and completing levels
- Mouse control - Move your spaceship with mouse movement
- Click to shoot - Fire bullets by clicking
- Keyboard support - Alternative controls available
- Retro space theme - Dark space background with twinkling stars
- Neon UI elements - Green glowing interface with futuristic styling
- Smooth animations - Fluid movement and particle effects
- Responsive design - Adapts to different screen sizes
- Pure HTML5/CSS3/JavaScript - No external dependencies
- Canvas-based rendering - Smooth 60fps gameplay
- Local high score tracking - Best scores saved locally
- Multiple game modes - Mission mode and Quick Play options
- Launch the game by opening
index.htmlin your web browser - Click "Start Mission" from the main menu to begin
- Move your spaceship using your mouse
- Click to shoot bullets at the descending alien invaders
- Avoid enemy fire - Don't let enemy bullets hit your ship
- Defeat the boss - Each level ends with a boss battle
- Progress through levels - Complete objectives to advance
The game features a comprehensive HUD showing:
- Score: Current points earned
- Lives: Remaining lives (starts at 3)
- Level: Current level progression
- Best Score: Personal high score record
- Boss Health: Health bar for boss enemies
Game/
โโโ index.html # Main HTML file
โโโ style.css # Game styling and animations
โโโ config.js # ๐ฏ GAME CONFIGURATION (EDIT THIS!)
โโโ script_fixed.js # Main game logic
โโโ song/ # Audio files
โโโ image/ # Game screenshots
Start with config.js - this file contains all the settings you can easily change:
// In config.js, find DIFFICULTY_CONFIG and modify:
easy: {
enemySpeedMultiplier: 0.3, // Much slower enemies
enemyShootMultiplier: 0.2, // Less enemy shooting
playerLives: 10, // More lives
powerUpChance: 0.5 // More power-ups
}// Colors in EFFECTS_CONFIG:
colors: {
player: "#ff0000", // Red player
enemy: "#ffff00", // Yellow enemies
background: "#000080" // Dark blue background
}// In PLAYER_CONFIG:
speed: 10, // Faster player movement (default: 7)
// In INVADER_CONFIG:
initialSpeed: 0.5, // Slower enemies (default: 1)// In POWERUP_CONFIG:
duration: 1200, // Power-ups last longer (default: 600)
spawnChance: 0.3 // More frequent power-ups (default: 0.15)// In AUDIO_CONFIG:
masterVolume: 0.5, // Louder audio (default: 0.3)
soundEffectsVolume: 0.8 // Louder sound effectsFor more complex changes, edit script_fixed.js:
- New enemy types: Modify the
Invaderclass - New weapons: Add cases to the weapon switch in Player.shoot()
- New game modes: Modify the game state logic
- Custom levels: Edit the
createInvaders()function
- Always backup files before making changes
- Test incrementally - change one thing at a time
- Use browser developer tools to debug errors
- Check browser console for error messages
- Start with small values when experimenting
- God Mode: Set
godMode: truein DEFAULT_SETTINGS - Infinite Lives: Set
startingLives: 999in PLAYER_CONFIG - Super Speed: Increase
speedvalues in configs - Rainbow Mode: Modify color arrays in EFFECTS_CONFIG
- Clone or download this repository
- Open
index.htmlin any modern web browser - No additional setup required - the game runs entirely in the browser!
- โ Chrome (recommended)
- โ Firefox
- โ Safari
- โ Edge
- โ Mobile browsers
Game/
โโโ index.html # Main game file
โโโ script.js # Game logic and mechanics
โโโ script_fixed.js # Alternative/fixed version
โโโ style.css # Game styling and animations
โโโ Readme.md # This documentation
โโโ image/ # Game screenshots
โโโ Screenshot 2025-07-23 080921.png # Gameplay screenshot
โโโ Screenshot 2025-07-23 080943.png # Main menu screenshot
Feel free to contribute to this project by:
- Reporting bugs
- Suggesting new features
- Improving game mechanics
- Enhancing visual effects
- Optimizing performance
This project is open source. Feel free to use, modify, and distribute as needed.
Enjoy defending Earth from the alien invasion! ๐ธ๐พ

