Asteroids-2026/CLAUDE.md

2.1 KiB
Raw Blame History

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

This is a Phaser 3 HTML5 top-down space shooter game (Asteroids-inspired). The project is currently in the early implementation phase — Software.md is the authoritative game design specification.

Local Development

Start the development server (serves files at http://localhost:8000):

./start_web.sh
# or equivalently:
python3 -m http.server 8000

There is no build step, bundler, or package manager. Open index.html directly in the browser via the HTTP server.

Technical Constraints

  • Framework: Phaser 3 (loaded via CDN or local file)
  • Language: JavaScript ES6 modules using native import/export
  • No bundler (no Webpack, Vite, Rollup, etc.) — modules must be referenced directly and served over HTTP (not file://)
  • Resolution: 1600×900
  • Graphics: Vector/placeholder graphics first; sprite replacement comes later

Game Design Summary (from Software.md)

Levels: A level ends when all asteroids and alien ships are destroyed. Player always respawns at screen center on new level.

Asteroids:

  • Spawn at level start, rotate slowly in a random direction/speed
  • Large → 13 mid or small fragments on destruction
  • Mid → 2 small fragments on destruction
  • Small → fully destroyed

Alien Ships: Periodically attack, move toward the player, fire occasionally. Destroyed by a single player shot.

Controls:

  • Ship rotates to follow the mouse cursor at a fixed rate (360° turn = 2 seconds)
  • Left mouse button = thrust/accelerator
  • a key or space = fire weapon
  • Zero-gravity physics: ship accelerates over ~2 seconds to full speed, decelerates gradually when thrust stops

Architecture Guidelines

Organize game entities as separate ES6 modules (e.g., Player.js, Asteroid.js, AlienShip.js, Bullet.js, GameScene.js). Each module exports its class; scenes import and instantiate them. Avoid circular dependencies — prefer a single scene that owns all game objects.