Go to file
Brian Fertig b92323a517 Added ReamMe.md 2026-02-14 11:26:40 -07:00
assets initial commit 2026-02-14 11:19:48 -07:00
js initial commit 2026-02-14 11:19:48 -07:00
BASE_DEFENSE_PLAN.md initial commit 2026-02-14 11:19:48 -07:00
ReadMe.md Added ReamMe.md 2026-02-14 11:26:40 -07:00
index.html initial commit 2026-02-14 11:19:48 -07:00
start_web.bat initial commit 2026-02-14 11:19:48 -07:00
start_web.sh initial commit 2026-02-14 11:19:48 -07:00

ReadMe.md

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