Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Space Game JS

GitHub repo size GitHub last commit Stars GitHub Pages


JavaScript/HTML5 Canvas space shooter, based on the Kodeco (Ray Wenderlich) Cocos2d-x tutorial, rebuilt as a browser game.

Tutorial source: https://www.kodeco.com/2728-cocos2d-x-tutorial-for-ios-and-android-space-game


Play Online


Features

  • Player ship movement (keyboard)
  • Laser shooting with object pooling
  • Asteroid spawning with pooling
  • Laser ↔ asteroid collision detection
  • Ship hit detection, lives, and invulnerability blink
  • Win/Lose game states and restart
  • Parallax scrolling backgrounds
  • Particle starfield
  • Background music + sound effects
  • Debug toggles for tuning
  • Top menu + dark/light theme toggle

Controls

  • Move: ASDW or ↑ ↓ ← →
  • Fire: Space
  • Restart: R or Enter
  • Toggle Audio: M
  • Debug: P
  • Parallax seam debug: O
  • World speed: K / L

Tech Stack

  • Vanilla JavaScript (ES Modules)
  • HTML5 Canvas
  • CSS
  • Audio via HTMLAudioElement
  • Texture atlas + plist parsing

Run Locally

Option 1: npm (recommended)

npm install
npm start

Then open: http://127.0.0.1:5500/

Option 2: VS Code Live Server

  1. Open project in VS Code
  2. Run Live Server on index.html
  3. Open in browser

Option 3: Python static server

python -m http.server 5500

Then open: http://127.0.0.1:5500/


Project Structure

assets/
  audio/
    music/
    sfx/
  images/
  particles/
src/
  audio/
  entities/
  fx/
  gfx/
  game.js
  input.js
index.html
package.json

Audio Notes

  • Background music uses assets/audio/music/SpaceGame.ogg with MP3 fallback.
  • Sound effects are loaded from assets/audio/sfx/.

Screenshots

Gameplay screenshot


Roadmap

  • Explosion particle effects on asteroid hit
  • Enemy ships + enemy lasers
  • Score system + high score persistence
  • Power-ups
  • Mobile/touch controls
  • Settings panel (audio volume, difficulty)

Related Projects


Credits

  • Original tutorial/game design inspiration: Kodeco / Ray Wenderlich Cocos2d-x Space Game tutorial
  • Original C++ versions from Platform Game Development work

About

Space Game: JavaScript version of Cocos2d tutorial

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages