A complete 2D zombie survival shooter game built with HTML5 Canvas, CSS, and JavaScript. Fight waves of zombies, manage your ammo, and survive as long as possible!
Simply open index.html in your web browser to start playing immediately!
- Smooth player movement with WASD keys
- Mouse-aimed shooting with left-click
- Reload system with R key
- Wave-based zombie spawning with increasing difficulty
- Health and ammo management
- Score tracking (10 points per zombie kill)
- Progressive difficulty - zombies get faster and stronger every 5 waves
- Game over and restart functionality
- Real-time UI showing health, ammo, score, and wave number
- Visual feedback with health bars and hit effects
- W, A, S, D - Move player
- Mouse - Aim
- Left Click - Shoot
- R - Reload
- Enter - Restart game (on Game Over screen)
- Starts with 100 health (blue circle)
- Pistol with 12 rounds per clip
- Takes damage when touched by zombies
- Dies when health reaches 0
- Health bar displayed above player
- Spawn randomly at screen edges (red squares)
- Move toward player using vector math
- Deal 20 damage per second when touching player
- Health and speed increase with each wave
- Drop 10 points when killed
- Health bars displayed above each zombie
- Start with 5 zombies per wave
- Each wave adds 2 more zombies
- Every 5 waves: zombie speed +10, health +25, spawn rate increases
- Infinite waves for endless gameplay
- Download or clone this repository
- Open
index.htmlin any modern web browser - Start playing immediately!
For better performance, you can serve the files through a local server:
# Using Python
python -m http.server 8000
# Using Node.js
npx http-server
# Using PHP
php -S localhost:80000Then visit http://localhost:8000 in your browser.
- Framework: Pure HTML5 Canvas, CSS3, and ES6+ JavaScript
- Framerate: 60 FPS with requestAnimationFrame
- Resolution: 1280x720 canvas
- Physics: Delta time-based movement for smooth gameplay
- Collision: AABB (bounding box) collision detection
- Architecture: Object-oriented design with clean class structure
- Cross-platform: Works on any device with a modern web browser
2D-Zombie-Survival-Shooter/
├── index.html # Main HTML file
├── style.css # Game styling and UI
├── script.js # Game logic and classes
├── README.md # This file
├── LICENSE # License information
└── .gitignore # Git ignore file
file
- ✅ Chrome 60+
- ✅ Firefox 55+
- ✅ Safari 11+
- ✅ Edge 79+
- ✅ Mobile browsers (iOS Safari, Chrome Mobile)
- Keep moving! Standing still makes you an easy target
- Manage your ammo carefully - reload when safe
- Use screen edges to funnel zombies into narrow paths
- Early waves are easier - use them to practice aiming
- Health doesn't regenerate - avoid damage at all costs
- Watch for color changes in UI elements indicating danger
- Main game loop and state management
- Handles events, updates, and rendering
- Manages wave progression and difficulty scaling
- Movement with WASD keys
- Shooting mechanics with mouse aiming
- Health and ammo management
- Reload system with timing
- AI movement toward player using vector math
- Health system with visual damage feedback
- Collision detection with player
- Physics-based movement
- Collision detection with zombies
- Automatic cleanup when out of bounds
- Utility class for 2D vector mathematics
- Handles position, velocity, and direction calculations
Potential features for expansion:
- Multiple weapon types
- Power-ups and health packs
- Sound effects and music
- Particle effects for explosions
- Leaderboard system with local storage
- Different zombie types with unique behaviors
- Mobile touch controls
- Fullscreen mode
This project is open source. See LICENSE file for details.
Feel free to fork this project and submit pull requests with improvements!