Hotbar¶
ModularHotbar provides a quick-access horizontal bar for items, typically displayed at the bottom center of the screen. It displays a specific "window" of the player's main inventory.
Setup¶
- Add a
ModularHotbarnode to your UI. - Assign an
HBoxContainerto theslots_containerproperty. - Link it to an
InventoryComponentvia thesource_componentproperty. - Configure the window:
hotbar_size: How many slots to display (e.g., 9).start_index: starting index in the main inventory (e.g., 0 for slots 0-8).
Scroll Navigation¶
Players can cycle through hotbar slots using the mouse wheel.
- enable_scroll_navigation: Toggles mouse wheel support.
- scroll_wraps: If true, scrolling past the last slot loops back to the first.
Signals¶
| Signal | Description |
|---|---|
selection_changed(new_index: int) |
Emitted when the player scrolls or clicks a new slot. |
Input Handling¶
- Left Click: Selects the slot.
- Right Click: Starts a drag operation picking up exactly 1 item.
- Shift + Left Click: Instantly transfers the entire stack to another open inventory (Quick Move).
- Scroll Wheel: Changes the
selected_indexand emitsselection_changed.