Added ReamMe.md

This commit is contained in:
Brian Fertig 2026-02-14 11:26:40 -07:00
parent 3d9d3537b5
commit b92323a517
1 changed files with 47 additions and 0 deletions

47
ReadMe.md Normal file
View File

@ -0,0 +1,47 @@
# Repository Overview
This repository contains a small Phaserbased game that manages enemy spawning and level progression using JSON configuration files and a dedicated `LevelManager` class.
## Assets
### `assets/data/levels.json`
Defines the parameters for each game level:
| Level | Spawn Interval (ms) | Enemy Types | Enemy Multiplier |
|-------|---------------------|----------------------------|------------------|
| 1 | 2000 | `grunt` | 1.0 |
| 2 | 1800 | `grunt`, `brute` | 1.2 |
| 3 | 1600 | `grunt`, `brute`, `tank` | 1.5 |
- **`spawnInterval`** Time between enemy spawns (lower = faster).
- **`enemyTypes`** Array of unit keys that may appear on the level.
- **`enemyMultiplier`** Multiplier applied to enemy stats (e.g., health) to increase difficulty.
### `assets/data/units.json`
Describes the base stats for each enemy type used in the game:
| Unit | Health | Speed | XP | Collision Damage | Width (px) | Height (px) |
|-------|--------|-------|----|------------------|-----------|------------|
| grunt | 30 | 80 | 10 | 15 | 96 | 96 |
| brute | 80 | 60 | 25 | 30 | 96 | 96 |
| tank | 150 | 40 | 50 | 45 | 128 | 128 |
These values are referenced when spawning enemies, calculating damage, and awarding experience points.
## Source Code
### `js/managers/LevelManager.js`
A lightweight manager that handles level state and progression:
- **Constructor** receives the current Phaser scene and the parsed `levels.json` data.
- Stores the current level (`currentLevel`) and its configuration (`currentConfig`).
- **`startLevel(num)`** Switches to a specific level, updating `currentLevel` and `currentConfig`.
- **`levelUp()`** Advances to the next level (if one exists), calls `startLevel`, and updates the spawn interval in the scenes `spawnManager`.
This class isolates levelrelated logic, making it easy to broadcast UI events or extend functionality later.
### `js/scenes/GameScene.js`
The main gameplay scene (a subclass of `Phaser.Scene`). While the full implementation is omitted, the class skeleton includes the typical Phaser lifecycle methods:
- **`preload()`** Load assets (sprites, JSON files, etc.).
- **`create()`** Set up the game world, instantiate managers (e