Skip to content

Interactable popups

YCQinBob edited this page Sep 17, 2026 · 1 revision

Interactable popups

Task: #132
PR: #142
Feature: HUD #98

Shows a short prompt when the player is in range of a door, dungeon exit, or pick-up item. The E key still fires interact and itemPickup on KeyboardPlayerInputComponent. The prompt lives on the player so it survives room changes.

Participants

  • Player (KeyboardPlayerInputComponent)
  • RoomManager
  • ItemPickupComponent
  • InteractionPrompt
  • InteractionPromptDisplay

Behaviour

  • Door: Press E — Next room (bookshelf: Press E — Enter dungeon).
  • Blocked exit: same HUD slot (e.g. Defeat all enemies first.).
  • Item: Press E — Pick up <name>. Item wins if both are in range.
  • Leave range or finish pickup: prompt hides.

Flowchart

flowchart TD
    A[Player in range] --> B{Item nearby?}
    B -->|yes| C[Item pickup text]
    B -->|no| D{Exit nearby?}
    D -->|no| E[Hide prompt]
    D -->|yes| F[Exit text from InteractionPrompt]
    C --> G[InteractionPrompt.resolve]
    F --> G
    G --> H[InteractionPromptDisplay.setPrompt]
    H --> I[Player presses E]
    I --> J[interact and itemPickup unchanged]
Loading

Sequence diagram

sequenceDiagram
    participant Room as RoomManager
    participant Pickup as ItemPickupComponent
    participant Copy as InteractionPrompt
    participant HUD as InteractionPromptDisplay
    participant Input as KeyboardPlayerInput

    Room->>Pickup: getPickupPrompt()
    Pickup-->>Room: item text or none
    Room->>Copy: forExit(...)
    Copy-->>Room: exit text or none
    Room->>Copy: resolve(item, exit)
    Copy-->>Room: HUD text
    Room->>HUD: setPrompt(text)
    Note over Input: E key not stolen
    Input->>Input: interact
    Input->>Input: itemPickup
Loading

Tests

  • InteractionPromptTest
  • CharmPickupComponentTest
  • KeyboardPlayerInputComponentTest

Table of Contents

Home

Test Plan

Team 2

Features

Components
Player
Items and Inventory
Enemies
Interactable NPCs
Cutscenes and Dialogue
Music
Bosses
Rooms
Weapons
Abilities & Spells
Game Screens and Areas
Dungeons

Game Engine

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally