Skills

Bevy Genre Puzzle

Bevy genre router for Puzzle.

Install

npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-genre-puzzle -g -a claude-code -y
Category
Engineering
Updated
19d ago
License
LGPL-3.0
Context cost
Mediumabout 2,329 tokens
Runs scripts
No, instructions only

What it does

Bevy genre router for Puzzle. Keywords: Bevy, Puzzle, genre, ECS, router.

Bevy Puzzle

Genre router. Domain work lives in the Bevy skills below.

When to use

Load this for grid rules and an undo stack you own.

ECS shape

  • Components hold the genre's per-entity flags as plain data. This file does not name new engine types.
  • Resources hold run-wide counters (score, wave index, seed) via bevy-data-resources.
  • Systems read those components on Update or the fixed timestep from bevy-master. Order them with .chain() when a later system must see the result.
  • Schedule: gameplay mode changes go through bevy-state-machines. Grid tiles and the undo stack below are components plus one resource.

Examples

[dependencies]
bevy = "0.20"

Each tile stores a grid coordinate and whether it is a goal. The undo stack is a resource of prior coordinates. Read input, push history, then slide. Those systems share Tile, so they chain.

#[derive(Clone, Copy)]
struct GridPos {
    x: i32,
    y: i32,
}

#[derive(Component)]
struct Tile {
    pos: GridPos,
    goal: bool,
}

#[derive(Component)]
struct PlayerToken;

#[derive(Resource, Default)]
struct UndoStack {
    steps: Vec<GridPos>,
}

fn boot(mut commands: Commands) {
    commands.insert_resource(UndoStack { steps: Vec::new() });
    commands.spawn((
        PlayerToken,
        Tile {
            pos: GridPos { x: 0, y: 0 },
            goal: false,
        },
    ));
    commands.spawn(Tile {
        pos: GridPos { x: 2, y: 0 },
        goal: true,
    });
}

fn read_move(keys: Res<ButtonInput<KeyCode>>) -> GridPos {
    if keys.just_pressed(KeyCode::ArrowRight) {
        GridPos { x: 1, y: 0 }
    } else if keys.just_pressed(KeyCode::ArrowLeft) {
        GridPos { x: -1, y: 0 }
    } else if keys.just_pressed(KeyCode::ArrowUp) {
        GridPos { x: 0, y: 1 }
    } else if keys.just_pressed(KeyCode::ArrowDown) {
        GridPos { x: 0, y: -1 }
    } else {
        GridPos { x: 0, y: 0 }
    }
}
Read the whole SKILL.md on GitHub

More in Engineering