BilliardHUD
Shows whose shot it is, every ball each player has sunk, and how hard the cue is pulled.
What it does
Across the top is a card for each player: their name, how many balls they have potted, and each of those balls in its own colours. Stripes show as a band on white. The card of whoever is shooting glows, and says TO SHOOT. When the table is clear, the winner's card turns green.
When the turn moves, a message shows in the middle for a moment: "Bo's turn", "Scratch! Ann's turn", "Bo shoots again". The final result stays up until the next rack.
Along the bottom, a line coaches the shot with a power bar under it. Before you press it says "Press and hold, then drag BACK to pull the cue". While you drag it says "Power 64% · let go to shoot", and the bar fills green to red. While the balls roll it says so.
Bottom left, a SPIN ball shows where the cue tip will land: a red dot that the up and down arrows move. Above the centre is follow, below is draw, and the label says which and how far, in radii. Turn off the cue's own face when you use it.
It is a DOM overlay over the canvas, so it works the same under Babylon and Three. With no document (a test, a worker) it builds nothing. It only listens, and its one button, NEW GAME, only asks for a rack.
Use it in a scene
A scene is just data — a list of entities, each with its components. At startup the SceneLoader turns this JSON into a live world; edit the file and reload to rebuild it.
Build it from scratch with the bjs CLI:
- 1Scaffold a project
World, renderer, and dev server — ready to run.
- 2Install dependencies
- 3Add BilliardHUD
Copies its source into src/ so the scene resolves.
First time? Run bjs login once.
- 4Paste the scene into src/scenes/arcade-room.ts and run
SceneLoader builds the world from the JSON; reload to rebuild.
Props
showHelp(boolean, defaulttrue). Show the keys along the bottom.toastSeconds(number, default1.8). How long a turn message stays up.
Events
Emits:
billiards.rack.request,{}. From the NEW GAME button.
Listens to:
billiards.turns.changed. The player cards and the turn message.billiards.cue.power.changed. The coaching line and the power bar.
Dependencies
BilliardTurns. Whose turn it is and what each player potted.BilliardCue. The power it is pulled to.BilliardBall. The colour of each ball.


















