Log inGet started
Package

ScreenHost.component

Newest version

README.md

game.ScreenHost

Blockhaven's screens in play: the title screen until the player presses PLAY, then the in-play HUD.

Attach it to one entity (the scene's ScreenHost) with no settings:

host.component.add("game.ScreenHost", {})

It registers the two screens game/screen.module authors, on layers 600 (the title) and 40 (the HUD), and swaps between them on the PLAY callback. The screens belong to this component's instance, so they go when the entity does.

The HUD shows the coins the pickupsKit ledger holds for this peer (require("pickupsKit.api").get(player, "coins")) and the three outfits of game.Blockhaven.OUTFITS, each with its price until it is owned. Ownership is read from game/avatar: the ids in its worn table, plus every id passed to its apply(player, id), which this component wraps.

Siblings it expects: the pickupsKit ledger (its PickupHUD is hidden while this HUD is up, so there is one coin counter in the corner, not two) and game/avatar for the wardrobe.