A feature-rich HTML5 vertical-scrolling space shooter with roguelike upgrade mechanics, built for CrazyGames publishing.
GAME DEVELOPED BY MUHAMMAD JUNAID
- Vercel: space-blaster.vercel.app
- GitHub Repo: github.com/waseemnasir2k26/space-blaster
- Vertical scrolling space shooter with auto-fire
- Touch drag-to-move controls (relative movement, not absolute)
- Mouse support for desktop play
- 60 FPS game loop with delta-time normalization
- Screen shake, particle effects, score popups
| Ship | HP | Speed | Damage | Cost | Special |
|---|---|---|---|---|---|
| Striker | 3 | 35 | 1 | Free | Balanced fighter |
| Phantom | 2 | 48 | 1 | 500π | Dash ability, fast & fragile |
| Titan | 5 | 25 | 2 | 1200π | Ram ability, tanky bruiser |
| Spectre | 3 | 33 | 1 | 2000π | Auto-shield specialist |
| Nova | 1 | 38 | 3 | 3500π | Critical hit glass cannon |
| Enemy | Behavior |
|---|---|
| Basic | Moves straight down |
| Zigzag | Sine-wave horizontal movement |
| Tank | Stops at top, shoots aimed bullets |
| Kamikaze | Accelerates toward player |
| Splitter | Splits into 2 swarm enemies on death |
| Shielded | Extra shield HP that must be broken first |
| Sniper | Camps at top, fires precise aimed shots |
| Swarm | Small, fast, tracks player loosely |
| Boss | HP | Mechanic |
|---|---|---|
| Destroyer | 30+ | 3 phases β sweep, aimed fire, spiral bullets |
| Hivemind | 45+ | 4 phases β spawns swarm minions every 5s |
| Void Lord | 60+ | 3 phases β teleports randomly, enrages at low HP |
All bosses scale with wave number (+8 HP per wave).
Every 3 waves, pick 1 of 3 randomly offered upgrades. Weighted by rarity:
Weapons (8): Side Cannons, Rear Shot, Piercing Rounds, Homing Missiles, Spread Shot, Rapid Fire, Power Rounds, Volatile Rounds
Defense (4): Orbiters, Nano Repair, Hull Plating, Energy Shield
Utility (5): Magnet Field, Neural Link (XP), Fortune Module (luck), Thrusters, Weak Points (crit)
Special (3): Smart Bomb, Time Warp (slow field), Attack Drone
Rarities: Common (Γ5 weight), Rare (Γ3 weight), Epic (Γ1 weight)
- Endless: Survive infinite waves, boss every 5 waves
- Boss Rush: Boss after boss, no regular waves
- Blitz: 15-wave speedrun, boss every 3 waves
Zones cycle every 5 waves with unique color palettes:
- Asteroid Belt (blue)
- Crimson Nebula (red/pink)
- Frozen Depths (cyan)
- Dark Matter (purple)
- Alien Core (green)
Achievements award bonus crystals. Examples:
- First Blood, Centurion (100 kills), Destroyer (500 kills)
- Veteran (wave 10), Elite (wave 25), Legend (wave 50)
- Boss Slayer, Boss Hunter (5 bosses), Untouchable (no-hit boss)
- Combo Master (Γ4.0), High Roller (50k), Millionaire (200k)
- Rampage (20 kill streak), Evolved (10 upgrades), Collector (all ships)
- Crystal currency earned from runs (score/100 + waveΓ5 + bossΓ50)
- Persistent ship unlocks saved across sessions
- High score tracking per device
- All data persists via CrazyGames Data module (with localStorage fallback)
The entire game is a single index.html file (~690 lines). Zero dependencies, zero build step, zero external assets.
- Rendering: HTML5 Canvas 2D
- Audio: Web Audio API (procedural sound synthesis β no audio files)
- Platform SDK: CrazyGames SDK v2
- Deployment: Vercel (static)
- Language: Vanilla JavaScript (ES6+)
index.html
βββ CrazySDK β CrazyGames SDK wrapper (ads, data persistence, gameplay events)
βββ Audio β Procedural sound effects via Web Audio API oscillators/noise
βββ PPool β Particle pool (400 max, object pooling)
βββ Bullets β Bullet pool (300 max, supports pierce/explode/homing)
βββ Player β Player ship with full upgrade state, XP/level, kill streaks
βββ Enemy β 8 enemy type AI behaviors
βββ Boss β Phase-based boss AI (sweep, aimed, spiral, rage)
βββ PU β Power-up pickups (health, XP, crystals)
βββ Game β Main game controller, state machine, collision, rendering, HUD
βββ Utilities β ch() collision, menu() toggle, roundRect polyfill
MENU ββββ startGame() βββββΆ PLAYING
β² β β β
β pause β β β death
β βΌ β β
β PAUSED β β
β β β β
β resume β β β
β βΌ β β
ββββ goMenu() ββββββ PLAYING ββββ β
β βΌ
β DYING (700ms)
β β
β βΌ
ββββ goMenu() ββββββ GAMEOVER βββ revive() βββΆ PLAYING
β β
ββββ goMenu() βββββββββββ
β
β showUpgradePicker()
PLAYING βββββββββββββββΆ UPGRADE
β² β
ββββ pick upgrade ββββββ
loop(t) βββΆ update(dt) βββΆ render()
β β
ββ Player input ββ Zone background gradient
ββ Auto-fire ββ Parallax starfield (3 layers)
ββ Enemy AI ββ Power-ups
ββ Boss AI ββ Enemies (unique shapes per type)
ββ Bullet pool ββ Boss
ββ Particles ββ Bullets (glow effects)
ββ Power-ups ββ Player ship (engines, cockpit, shield, orbiters)
ββ Collisions ββ Particles
ββ Wave spawner ββ Score popups
ββ Shake/popups ββ HUD (score, combo, HP, XP bar, wave, zone, upgrades)
Circle-vs-circle: dxΒ²+dyΒ²<(r1+r2)Β² for all entities.
- Object pooling for bullets (300) and particles (400) β zero GC allocation during gameplay
- Fixed logical resolution (390Γ844) with CSS scaling β consistent performance on any device
- Delta-time normalization β smooth gameplay regardless of frame rate
- Early exit on off-screen entities
Touch uses relative drag (not absolute position), preventing the player's finger from blocking the ship. Mouse also supported for desktop.
| Feature | Implementation |
|---|---|
game.gameplayStart() |
Called on game start and resume |
game.gameplayStop() |
Called on pause, game over, upgrade picker |
game.happytime() |
Triggered on new high score and boss kills |
ad.requestAd('midgame') |
Every 4 waves (180s cooldown) |
ad.requestAd('rewarded') |
Extra life on game over (one per run) |
data.set() / data.get() |
Save/load crystals, ships, high score, achievements |
- No Escape key binding (CrazyGames uses Escape for fullscreen exit)
- Arrow keys and Space default prevented
- Right-click disabled
- Scroll/wheel disabled
- Graceful adblock handling (SDK methods wrapped in try/catch)
- localStorage fallback when SDK unavailable
space-blaster/
βββ index.html # The entire game (single file)
βββ vercel.json # Vercel deployment config
βββ .gitignore # Standard ignores
βββ README.md # This file
βββ ARCHITECTURE.md # Deep technical documentation
βββ CHANGELOG.md # Version history
βββ GAME_DESIGN.md # Game design document
βββ CONTRIBUTING.md # How to contribute
βββ CrazyGames-Submission/
βββ SUBMISSION_GUIDE.md # CrazyGames publishing checklist
No build step required. Just open index.html in a browser:
# Clone
git clone https://github.com/waseemnasir2k26/space-blaster.git
cd space-blaster
# Option 1: Direct open
open index.html # macOS
start index.html # Windows
xdg-open index.html # Linux
# Option 2: Local server (recommended for CrazyGames SDK)
npx serve .
# or
python -m http.server 8000The CrazyGames SDK features (ads, data persistence) only work when hosted on CrazyGames. Locally, the game falls back to localStorage.
Push to main β auto-deploys via Vercel Git integration. Config in vercel.json:
- No build command
- Output directory:
. - Cache headers: 1 hour
See CrazyGames-Submission/SUBMISSION_GUIDE.md for the full publishing checklist.
- Game Design & Development: Muhammad Junaid
- AI Pair Programming: Claude (Anthropic)
- Platform SDK: CrazyGames SDK v2
- Audio: Procedurally generated via Web Audio API
- Graphics: Canvas 2D procedural rendering (no external assets)
All rights reserved. Game developed by Muhammad Junaid.