sugarcraft / honey-flap
Flappy-Bird-style game — port of kbrgl/flapioca on the SugarCraft stack.
Requires
- php: >=8.3
- sugarcraft/candy-core: dev-master
- sugarcraft/candy-sprinkles: dev-master
- sugarcraft/honey-bounce: dev-master
Requires (Dev)
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2026-05-24 22:48:09 UTC
README
HoneyFlap
Flappy-Bird-style game on the SugarCraft stack — port of kbrgl/flapioca. The bird's vertical motion is a HoneyBounce projectile (gravity + an upward velocity kick on each tap), pipes scroll left at a fixed cell rate, collision is per-cell.
Run it
composer install ./bin/honey-flap
Keys
| Key | Action |
|---|---|
Space / ↑ / w |
Flap |
r |
Restart |
q / Esc |
Quit |
Architecture
| File | Role |
|---|---|
Bird |
Wraps a HoneyBounce Projectile — gravity pulls it down, flap() resets vertical velocity to a fixed kick. |
Pipe |
Single-column pipe pair with a centred gap. Slides left one cell per tick. |
TickMsg |
Frame-tick message scheduled by Cmd::tick(0.033, …) ≈ 30 fps. |
Game (Model) |
Pure-state world: bird + pipes + score + crashed flag. Injects PRNG closure for deterministic gap placements in tests. |
Renderer |
Pure view — single playfield walk, ANSI-styled glyphs, rounded border. |
PipeGenerator |
Generates pipes with variable gap height — gap shrinks as score increases, raising difficulty. Gap starts at 6 cells, shrinks by 1 every 5 points, floors at 3. |
The PRNG is injected as a Closure(int $maxInclusive): int so unit tests can pin the pipe layout to a specific sequence — the standard SugarCraft pattern.
Difficulty scaling
The pipe gap height adapts to the player's score:
| Score range | Gap height |
|---|---|
| 0–4 | 6 cells |
| 5–9 | 5 cells |
| 10–14 | 4 cells |
| 15+ | 3 cells |
Gap shrinks by 1 every 5 points, bottoming out at 3 cells to keep the game playable. This is implemented by PipeGenerator::gapHeightForScore() and applied automatically when Game spawns new pipes via PipeGenerator::makePipe().
Test
composer install vendor/bin/phpunit
