Use Actor Portraits

Use Actor Portraits

ActorPortrait – actor portrait

Goal

  • Render an actor’s face portrait using the built-in <ActorPortrait> component. This tutorial focuses on consuming platform data and composing UI; all wiring is already handled.

What you’ll build

  • A small portrait panel that shows the party leader’s face image, sized with Tailwind classes.

  1. Import the component and read platform data Add the portrait to a screen (for example, menus/src/views/MapScreen.tsx).

Notes

  • <ActorPortrait> computes the correct face image path and cropping region via platform.gameInfo.faceImageSize.getFaceSprite(...) and renders through <ImageViewport>.

  • You control sizing with Tailwind (e.g., w-24 h-24). The component preserves the correct viewport slice within the face sheet.

  1. Style variations

  • Circle avatar: wrap the image in a rounded container.

  • Larger portrait: use w-36 h-36 (or any Tailwind size) to scale.

  1. Build and view Rebuild the UI as usual and run your game. The portrait should reflect the current party leader automatically thanks to MobX observability.

See also

Last updated