Space Invaders-style browser game with a small Go backend that serves the frontend and stores leaderboard scores in SQLite.
- Classic Space Invaders gameplay with lives, levels, and score tracking.
- Leaderboard showing the top 10 scores.
- Keyboard and touch controls.
- Pause menu, restart, and game over screen.
- Go 1.22+ with net/http and sqlite3 (github.com/mattn/go-sqlite3).
- Vanilla HTML/CSS/JS frontend.
- SQLite database at
database.db, schema inshema.sql.
- Install Go 1.22+ and a C compiler (required for sqlite3 CGO builds).
- Run the server:
go run . - Open
http://localhost:8080/in your browser.
- Left/Right Arrow: move the ship.
- Space: shoot.
- Esc: pause/resume.
- Touch: drag on the game board to move; tap to shoot.
POST /score- Body:
{"username":"player","score":123} - Stores the score in SQLite.
- Body:
GET /sendscores- Returns a JSON array of
{username, score}.
- Returns a JSON array of
main.go: Go web server, routes, and DB initialization.index.html,style.css,script.js: frontend entry points.modules/: game logic, UI, and leaderboard rendering.database.db: SQLite database file (auto-created/updated at startup).shema.sql: database schema for theuserstable.