Skip to content

engine: when_composite_free and Direction - #96

Closed
ffex wants to merge 1 commit into
olive-empire-harvest-helpersfrom
olive-empire-scroll-helpers
Closed

ffex wants to merge 1 commit into
olive-empire-harvest-helpersfrom
olive-empire-scroll-helpers

Conversation

@ffex

@ffex ffex commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Summary

A public check of the blocked moves for any code: when_composite_free runs a body when a composite's hitbox can step towards a direction without touching a solid tile. olive-empire uses it to scroll the background instead of moving the player at the view's margins (#95). Stacked on #94 (and so #92); it reaches refactor with them.

What changed

  • src/engine/sprites.rs: pub enum Direction { Left, Right, Up, Down }; SpriteManager::when_composite_free(id, direction, distance, hitbox, solid, body) (the private blocked_points + TileCollision::when_free); the four move_composite_*_blocked and when_composite_touches are built on it.
  • src/engine/mod.rs, src/prelude.rs: export Direction.
  • Task.md, CHANGELOG.md: entries.

How it was verified

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings: clean.
  • cargo test: all pass (478 lib tests); new test: each blocked move emits exactly when_composite_free with the limited move, and a non-move body reads the expected points. Snapshots unchanged.
  • RGBDS_LINK_CHECK=1 cargo test --lib --test emulator: 115 pass.

Generated-asm impact

  • None.

Risks and follow-ups

  • New public name Direction in the prelude.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ffex

ffex commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

Moved to #97, which targets refactor with only the engine commits.

@ffex ffex closed this Oct 30, 2026
@ffex
ffex deleted the olive-empire-scroll-helpers branch October 30, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant