3.0 KiB
3.0 KiB
AGENTS.md
Project
"Light & Dark" — a 2D light/shade platformer prototype (Python 3.10 + pygame).
- Main game:
light_and_dark/main.py(single large file, ~8000 lines, no tests) - Level editor:
light_and_dark/level_editor_v43.html(standalone HTML/JS, no build step) - Levels:
light_and_dark/data/world/rooms/room_0N.json - Data/config:
light_and_dark/data/config/*.json,data/items/*.json,data/objects/*.json,data/enemies/*.json
Standard session start
git status+git log --oneline -5to see uncommitted/untracked work (rooms 4-6 are untracked/WIP).- Read the specific file(s) the request touches before editing; follow existing style.
- After edits, always verify (see below).
Verification
python -m py_compile light_and_dark/main.py(must pass after any edit)- Validate touched JSON:
python -c "import json; json.load(open('<path>', encoding='utf-8'))" - To confirm the game boots: run
python light_and_dark/main.pywith a short timeout; no traceback in the first lines = OK (the window blocks, so it will time out).
Pitfalls / conventions
- Python booleans are
True/False— nevertrue/falsein main.py (this once crashed startup). JSON files use lowercasetrue. - Don't add code comments unless asked. Match surrounding style.
- Rooms load through
normalize_room_json+Room(main.py) which rewrite JSON into the game format; keep new room JSON keys mirrored there (e.g. trigger/ability-door flags).
Key systems (in main.py unless noted)
- Saves: lantern-only.
save_game/apply_save_data. Quest progress, broken doors, defeated bosses persist ONLY on lantern interaction. - Trigger walls (
trigger_wall_blocking): meta keysquest,quest_complete,quest_turned_in,lock_when_pass(appears once walked through),open_on_miniboss_dead. - Ability doors (
AbilityDoor):kind="ranged"(shot open, persists inbroken_doors) or"shade"(solid in light, passable in shade + ashade_door_gracewindow after form switch; ejected to nearest edge after grace). - Quests (
QUEST_DEFS_DEFAULT): objective"shade": Truecounts kills only in shade form. Rewards viaguaranteed_item(one-time) orpool(repeatable). Items byitem_id(e.g.necklace_placeholder= "Plain Necklace"). - Minibosses: stay defeated per room (
DEFEATED_MINIBOSSES) until a lantern save in a different room, then respawn. - Enemies: insta-die on hazard contact with no drops (
hazard_killflag); normal enemies respawn on room re-entry. - Chests (
RewardChest): spawn coinCoinPickups above the chest top (not center, which clips into the platform). - Shade-kills quest (
first_kills_shadein room 6): interactable/prompted only while in shade form (QuestManager.requires_shade).
Editor (level_editor_v43.html)
- Link lines:
drawLinkLinesForCanvas— exits with aspawn_idmissing in the target room draw NO line (avoids stale-coordinate artifacts). - Keyboard shortcuts live in the
window keydownhandler: V/P/E/N/O switch tools, F fit, Esc deselect, Ctrl+Z/Y/C/X/V/D.