No description
Find a file
Harald Hoyer ad2037a7a5 refactor: idiomatic cleanup across the codebase
Net -311 lines (1075 → 764). Build clean, clippy clean, 8 tests pass,
headless render verified.

Highlights:
- player.rs: bug fix in handle_captured_player — was cloning captured.timer
  and ticking the clone, never the real timer. Consolidated kill_player as
  pub(crate) helper (was duplicated across 3 sites). Switched from ParamSet
  to two disjoint Queries.
- enemy.rs: extracted step_attacker(), spawn_beam_visual(), end_beam(),
  pick_pattern() helpers — move_enemies is no longer 3-deep nested matches,
  beam cleanup no longer duplicated. Fixed SwoopDive overshoot check (was
  using already-applied movement). Mid-file `use` hoisted to top.
- resources.rs: added StageConfigurations::for_stage() helper (was repeated
  4×); FormationState/Score/CurrentStage now Default; extracted
  circle_formation() helper.
- stage.rs: replaced raw world: &mut World access with ordinary ResMut
  system params (no need — resource types are disjoint).
- game_state.rs: cleanup queries collapsed via Or<…> filters; dropped dead
  RestartMessage cleanup from cleanup_game_entities; button colors
  extracted as constants.
- bullet.rs: reuses kill_player; introduced GRUNT_POINTS/BOSS_POINTS with
  TODO referencing GAL-27.
- lib.rs: init_resource::<T>() for Default-implementing resources.
- Removed unused TRACTOR_BEAM_COLOR constant.
- Replaced per-frame println! debug spam with targeted info!/warn!.
- Stripped noise comments that restated what the code does.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 21:36:26 +02:00
.roo iii 2025-04-11 10:43:48 +02:00
.vscode feat: add cratedocs server configuration to mcp.json 2025-04-15 12:05:18 +02:00
src refactor: idiomatic cleanup across the codebase 2026-05-06 21:36:26 +02:00
.envrc feat: initial commit 2025-03-29 10:58:19 +01:00
.gitignore chore: add wav files to .gitignore 2026-05-04 22:15:51 +02:00
.mcp.json add .mcp.json 2026-05-06 21:09:21 +02:00
AGENTS.md chore: add opencode config, replace AGENT.md with AGENTS.md 2026-05-04 22:15:32 +02:00
Cargo.lock chore(deps): upgrade Bevy 0.13 → 0.18 2026-05-06 21:26:48 +02:00
Cargo.toml chore(deps): upgrade Bevy 0.13 → 0.18 2026-05-06 21:26:48 +02:00
flake.lock refactor: replace nixify with flake-utils and rust-overlay in flake.nix 2026-05-04 22:15:27 +02:00
flake.nix chore(deps): upgrade Bevy 0.13 → 0.18 2026-05-06 21:26:48 +02:00
GEMINI.md feat: Implement boss tractor beam and player capture 2025-06-26 09:46:49 +02:00
opencode.json chore: add opencode config, replace AGENT.md with AGENTS.md 2026-05-04 22:15:32 +02:00
README.md feat: add take-screenshots flake app for headless capture 2026-05-06 21:01:14 +02:00
TODO.md chore(todo): uncheck GAL-25/GAL-27 — Boss points not differentiated 2026-05-06 21:12:27 +02:00

bglga

This project is a simple Galaga-like space shooter game built using the Bevy engine.

Current State

The game features:

  • A player ship at the bottom of the screen that can move left and right.
  • Shooting bullets upward using the spacebar or up arrow key.
  • Enemy ships that spawn at the top and move downward.
  • Collision detection between bullets and enemies.
  • Collision detection between the player and enemies.
  • A player lives system (starting with 3 lives).
  • Player destruction upon collision.
  • Player respawn after a short delay with temporary invincibility.
  • Remaining lives displayed in the window title.

Controls

  • Move Left: A key or Left Arrow
  • Move Right: D key or Right Arrow
  • Shoot: Spacebar or Up Arrow

How to Compile

nix develop --command bash -c "cargo build"

How to Run

  1. Make sure you have Rust and Nix installed.
  2. Clone the repository.
  3. Navigate to the project directory.
  4. Run the game using the command: nix develop --command bash -c "cargo run"

Headless Screenshots

The flake exposes a take-screenshots app that launches a binary inside an Xvfb display backed by lavapipe (software Vulkan), waits, and captures one or more PNG screenshots. Useful for smoke-testing rendering without a real GPU.

nix run .#take-screenshots -- EXE NUM DELAY_START PAUSE_INBETWEEN [OUTPUT_DIR]
  • EXE — path to the executable to launch
  • NUM — number of screenshots to take
  • DELAY_START — seconds to wait after launch before the first shot
  • PAUSE_INBETWEEN — seconds between consecutive shots
  • OUTPUT_DIR — where to write shot-NNN.png files (default: current directory)

Example, capturing three frames of the game one second apart after a six-second warm-up (Bevy + software Vulkan needs roughly that long to render its first frame):

cargo build
nix run .#take-screenshots -- ./target/debug/bglga 3 6 1 ./shots