update docs and fix the symlinks
This commit is contained in:
parent
6d5406c6c5
commit
f96381f2f0
6 changed files with 810 additions and 831 deletions
46
CLAUDE.md
46
CLAUDE.md
|
|
@ -4,23 +4,18 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||
|
||||
## Project Overview
|
||||
|
||||
This is a LÖVE2D game development playground using Fennel (a Lisp dialect that compiles to Lua). The repository contains multiple game/project experiments:
|
||||
|
||||
- **hello_world**: Basic LÖVE2D + Fennel template with REPL support
|
||||
- **hello_world_lua**: Basic LÖVE2D in pure Lua (reference implementation)
|
||||
- **one_line**: A pixel drawing application demonstrating canvas manipulation
|
||||
- **two_player_cleaning_game**: Two-player game (primary focus for development)
|
||||
This is a two-player cooperative cleaning game built with LÖVE2D using Fennel (a Lisp dialect that compiles to Lua).
|
||||
|
||||
## Key Architecture
|
||||
|
||||
### Fennel + LÖVE2D Setup
|
||||
|
||||
Fennel is a Lisp-like language that compiles to Lua at runtime. Each project directory shares common bootstrap files via symlinks:
|
||||
Fennel is a Lisp-like language that compiles to Lua at runtime. The project uses symlinked bootstrap files:
|
||||
|
||||
- **fennel-1.5.3.lua** (root): The Fennel compiler itself
|
||||
- **fennel_bootstrap.lua** (root): Sets up Fennel module loading and compiles `.fnl` files on-the-fly
|
||||
|
||||
Each project directory contains:
|
||||
The `two_player_cleaning_game` directory contains:
|
||||
- **main.fnl**: The Fennel source code (user-editable)
|
||||
- **main.lua** → symlink to `../fennel_bootstrap.lua`: Entry point that Lua/LÖVE2D loads
|
||||
- **fennel.lua** → symlink to `../fennel-1.5.3.lua`: Fennel compiler reference
|
||||
|
|
@ -39,11 +34,11 @@ Games define lifecycle callbacks (all optional):
|
|||
- **love.update()**: Called every frame (~60fps by default)
|
||||
- **love.draw()**: Called every frame after update, render graphics here
|
||||
- **love.keypressed(key)**: Keyboard input handler
|
||||
- **love.handlers.stdin(line)**: REPL input for live evaluation (used in hello_world template)
|
||||
- **love.handlers.stdin(line)**: REPL input for live evaluation (used for debug/live coding)
|
||||
|
||||
## Development Workflow
|
||||
|
||||
### Running a Game
|
||||
### Running the Game
|
||||
|
||||
```bash
|
||||
love ./two_player_cleaning_game
|
||||
|
|
@ -53,11 +48,7 @@ LÖVE2D must be installed and in your PATH. See [Getting Started](https://love2d
|
|||
|
||||
### Live Coding / REPL
|
||||
|
||||
The hello_world template includes stdin REPL support. While a game is running:
|
||||
- Type Fennel code at the terminal
|
||||
- Code is evaluated via `fennel.eval()` and results printed
|
||||
|
||||
To enable in other projects, add this to `love.load()`:
|
||||
To enable stdin REPL support for live evaluation, add this to `love.load()`:
|
||||
|
||||
```fennel
|
||||
(: (love.thread.newThread "require('love.event')
|
||||
|
|
@ -68,6 +59,8 @@ while 1 do love.event.push('stdin', io.read('*line')) end") :start)
|
|||
(print (if ok (fennel.view val) val))))
|
||||
```
|
||||
|
||||
While the game is running, type Fennel code at the terminal and it will be evaluated live.
|
||||
|
||||
## Fennel Language Basics
|
||||
|
||||
### Syntax Patterns
|
||||
|
|
@ -123,31 +116,18 @@ Access nested Lua objects with colon `:` syntax:
|
|||
(: canvas-obj :setFilter "nearest" "nearest") ; equivalent to canvas_obj:setFilter(...)
|
||||
```
|
||||
|
||||
## Project-Specific Notes
|
||||
|
||||
### two_player_cleaning_game
|
||||
|
||||
Currently uses the hello_world template structure. Development focus:
|
||||
- Extend main.fnl with game logic (player movement, cleanup mechanics, etc.)
|
||||
- Reference one_line/main.fnl for canvas/graphics patterns if needed
|
||||
- Use LÖVE2D physics (love.physics) or collision detection as needed
|
||||
|
||||
### Symlink Pattern
|
||||
|
||||
Do **not** modify symlinked files (main.lua, fennel.lua) — modify main.fnl instead. If adding new modules, create them as separate .fnl files in the project directory.
|
||||
|
||||
## Common Development Tasks
|
||||
|
||||
### Adding a new module/file
|
||||
|
||||
1. Create `my_module.fnl` in the project directory
|
||||
1. Create `my_module.fnl` in the `two_player_cleaning_game` directory
|
||||
2. Require it: `(local my-module (require "my_module"))`
|
||||
3. The bootstrap module loader will auto-compile it
|
||||
|
||||
### Debugging
|
||||
|
||||
- Use `(print (fennel.view value))` to inspect tables and complex values
|
||||
- stdin REPL (hello_world template) allows live evaluation for quick tests
|
||||
- Enable stdin REPL (see above) for quick live tests
|
||||
- LÖVE2D console output is visible in the terminal where you ran `love`
|
||||
|
||||
### Working with Graphics
|
||||
|
|
@ -162,6 +142,12 @@ LÖVE2D graphics API examples:
|
|||
(love.graphics.draw drawable x y) ; draw canvas/image
|
||||
```
|
||||
|
||||
## Code Guidelines
|
||||
|
||||
### Symlink Pattern
|
||||
|
||||
Do **not** modify symlinked files (main.lua, fennel.lua) — modify main.fnl instead. If adding new modules, create them as separate .fnl files in the project directory.
|
||||
|
||||
## References
|
||||
|
||||
- **LÖVE2D API**: https://love2d.org/wiki/Main_Page
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue