Claude-skill-registry flame-docs
[Flame] Flame engine quick reference. Component lifecycle, Collision, Effects, Camera and core API reference. (project)
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/flame-docs" ~/.claude/skills/majiayu000-claude-skill-registry-flame-docs && rm -rf "$T"
manifest:
skills/data/flame-docs/SKILL.mdsource content
Flame Engine Quick Reference
Component Lifecycle
onLoad() → onMount() → update(dt)/render(canvas) → onRemove()
| Method | Timing | Purpose |
|---|---|---|
| Once, async | Resource loading, initialization |
| On tree addition | Set parent/game references |
| Every frame | State update (dt = delta seconds) |
| Every frame | Draw to screen |
| On removal | Cleanup |
Core Classes
| Class | Purpose | Key Properties/Methods |
|---|---|---|
| Game root | , , |
| Hosts game components | , |
| Base component | , , , |
| Position/size/rotation | , , , , |
| Static sprite | , |
| Animation | , |
| Camera control | , , , |
Shape Components
- RectangleRectangleComponent
- CircleCircleComponent
- PolygonPolygonComponent
Collision Detection
Enable
// Add to Game or World class MyGame extends FlameGame with HasCollisionDetection {}
Hitbox Types
| Hitbox | Purpose |
|---|---|
| Rectangular collision area |
| Circular collision area |
| Polygon (convex only) |
| Screen boundaries |
| Composite hitbox |
Collision Callbacks
class MyComponent extends PositionComponent with CollisionCallbacks { @override void onCollisionStart(Set<Vector2> points, PositionComponent other) {} @override void onCollision(Set<Vector2> points, PositionComponent other) {} @override void onCollisionEnd(PositionComponent other) {} }
Collision Type (Performance)
- Checks against all hitboxesCollisionType.active
- Only checked by active (better performance)CollisionType.passive
- IgnoredCollisionType.inactive
Effects System
| Effect | Purpose | Example |
|---|---|---|
| Move to target | Character movement |
| Move by offset | Relative movement |
| Rotate to angle | Direction change |
| Change size | Zoom in/out |
| Color/opacity | Hit effect |
| Sequential execution | Complex animation |
| Opacity | Fade in/out |
Effect Controller
MoveEffect.to( Vector2(100, 100), EffectController(duration: 1.0, curve: Curves.easeInOut), );
Camera & World
Camera Methods
| Method | Purpose |
|---|---|
| Follow target |
| Move to coordinates |
| Move by offset |
| Stop movement |
| Limit camera movement |
| Check visibility |
Viewport Types
| Viewport | Purpose |
|---|---|
| Expand to max space (default) |
| Fixed resolution + aspect ratio |
| Fixed aspect ratio, scales |
| Fixed size |
Bridge Packages
flame_riverpod (State Management)
// Game class MyGame extends FlameGame with RiverpodGameMixin {} // Component class MyComponent extends Component with RiverpodComponentMixin { @override void onMount() { super.onMount(); final state = ref.watch(myProvider); } } // Widget RiverpodAwareGameWidget<MyGame>( game: game, )
flame_forge2d (Physics Engine)
class MyGame extends Forge2DGame {} class MyBody extends BodyComponent { @override Body createBody() { final shape = CircleShape()..radius = 10; final fixtureDef = FixtureDef(shape); final bodyDef = BodyDef(type: BodyType.dynamic); return world.createBody(bodyDef)..createFixture(fixtureDef); } }
flame_audio (Audio)
// Sound effects FlameAudio.play('explosion.mp3'); // BGM FlameAudio.bgm.play('background.mp3'); FlameAudio.bgm.stop(); FlameAudio.bgm.pause(); FlameAudio.bgm.resume();
Common Patterns
Add Component
await add(MyComponent()); // In onLoad add(MyComponent()); // In update
Remove Component
removeFromParent(); // Self component.removeFromParent(); // Other component
Query Children
children.query<Enemy>(); // Find by type componentsAtPoint(position); // Find by position findByKey(ComponentKey.named('player')); // Find by key
Priority (Z-order)
class MyComponent extends PositionComponent { MyComponent() : super(priority: 10); // Higher = rendered on top }