Pickup
Pickup gives an entity a reward that goes to the hero who walks within its radius. The hero is the entity with the Hero trait, which the Player component spawns.
Its props are in PickupProps.
Pickup credits the Wallet trait on the hero and destroys the entity in the same step. Just before the destroy, the step adds the Taken trait to the entity, which is what plays its sound: a pickup the scene removes untaken stays silent.
Where it runs
Section titled “Where it runs”Server. Pickup has a consequence: it changes the hero’s wallet.
import { Entity, Pickup, type EntityProps } from "@daniel-zarinski/engine";
export function Coin({ position }: Pick<EntityProps, "position">) { return ( <Entity model="coin" position={position}> <Pickup reward={1} /> </Entity> );}