DropTarget
Targets that fall when hit, in banks.
What it does
A drop target is a box the ball bounces off. Hit it and it falls into the playfield. Knock down the whole row and the row pays a bonus, then stands back up.
When a ball comes within hitRadius of a standing target:
- The mesh sinks
dropDepthinto the playfield. - Its physics body is destroyed, so the ball rolls over the spot. Hiding the mesh alone would leave an invisible wall.
- It says
dropTarget.downand payspoints.
Targets with the same bank name are one bank. When the last one drops, it says dropTarget.bankComplete and pays bankPoints. resetDelay seconds later the bank stands back up and says dropTarget.reset.
A target only rises once the ball is at least clearance away. A box that rises through the ball puts a solid where the ball already is, and the physics engine throws the ball out at once in whatever direction the overlap points. So a target under the ball waits, and its neighbours rise without it.
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 DropTarget
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.
Add Drop_2 and Drop_3 the same way with the same bank, a little further along x.
Props
bank(string, default"bank"). Targets with the same name drop and reset together.points(number, default500). Paid for each target.bankPoints(number, default5000). Paid for the whole bank.ownerEntity(string, default"Player"). Who gets the points.hitRadius(number, default1). Distance on the table (x, z) from the target's centre that knocks it down.resetDelay(seconds, default2.5). Wait after the bank is down before it stands up.0waits fordropTarget.resetRequest.dropDepth(number, default1.3). How far it sinks.clearance(number, default1.6). How far the ball must be before a target rises.
Events
Emits:
dropTarget.down,{ entityId, bank, points, remaining }.remainingis how many still stand.dropTarget.bankComplete,{ bank, count }.dropTarget.reset,{ bank }.score.add,{ ownerEntity, points }, once per target and once for the bank.
Listens to:
dropTarget.resetRequest,{ bank? }. Stand a bank up now. Nobankmeans every bank. Send it at the start of a new game.
Dependencies
MeshPrimitive on the same entity, and a static Physics body for the ball to hit. Score to count the points. The ball needs the ball tag.
The bank maths
- The bookkeeping is in
DropTarget.core.ts:createBank,knockDownandcanRaise. - A target that is already down is never knocked down again, so a bank completes once per reset.








































