Skip to content

Dialogue Box For NPC

DRG31 edited this page Sep 16, 2023 · 2 revisions

Overview

The DialogBox class is a custom dialog box designed to be used by everyone who wants to implement a dialog pop up component for interaction alerts and more . It serves as an introductory dialog box that presents an dialog box when the player clicks F when he encounters the Botanist cum Wizard in the game game. This class extends the LibGDX Dialog class and provides a structured and visually appealing way to present game-related information.

Screenshot 2023-09-14 at 1 24 39 PM 1

UML Diagrams

image image

Table of Contents

Usage

Methods

Event Handling

Contributors

Usage

The DialogBox class can be used to display a dialog box with the desired text , and a button.

Methods

showDialog(Stage stage) This method adds the Dialog instance to the specified stage, making it visible to the user.

Screenshot 2023-08-31 at 12 38 09 AM

stage: The Stage where the dialog should be displayed.

Event Handling

The DialogueBox class uses event handling to respond to button clicks. When the "OK" button is clicked, it triggers the "ok" event, which can be handled externally and removes the stage.

To handle the "ok" event, you can add a listener to an instance of the Entity class. In the provided example, the onOK() method is called when the "OK" button is clicked.

Contributors

Clone this wiki locally