Physics overlap (pickups)
Walk into stars to collect them — the canonical "overlap as trigger" pattern with score tracking.
Notes
- Click the playground to give it keyboard focus first.
overlapvs.collider: overlap fires a callback when bounding boxes intersect without separating them — perfect for pickups, triggers, hitboxes.colliderseparates the bodies and stops them interpenetrating — for walls, floors, enemies.- Group convenience: a single
overlap(player, coinsGroup, cb)covers every coin in the group. No per-coin wiring. coin.destroy()removes the coin from the scene and the group; subsequent overlap checks skip it automatically.- See Arcade Physics for groups, dynamic vs. static bodies, tunneling pitfalls, and debug rendering.